Skip to content
Snippets Groups Projects
Commit 2e77cf83 authored by Xiao Gui's avatar Xiao Gui
Browse files

update netlify functions

parent a1ab719f
No related branches found
No related tags found
No related merge requests found
const fs = require('fs')
exports.handler = (ev, ctx, cb) => {
const {
path,
httpMethod,
headers,
queryStringParameters,
body,
isBase64Encoded,
} = ev
const re = /nehubaConfig\/(.+)$/.exec(path)
if (!re) {
return cb(null, {
status: 401,
body: `config name is required`
})
}
const configName = re[1]
fs.readFile(`./json/${configName}.json`, 'utf-8', (err, data) => {
if (err) {
return cb(null, {
status: 404,
body: `config ${configName} does not exist, ${err.toString()}`
})
}
return cb(null, {
status: 200,
body: data,
headers: {
'Content-type': 'application/json'
}
})
})
}
\ No newline at end of file
const fs = require('fs')
const path = require('path')
exports.handler = (ev, ctx, cb) => {
......
......@@ -2,6 +2,6 @@
[build]
publish="dist/aot/"
command="cp -R src/res/ext functions/templates/json && npm run build-aot"
command="cp -R src/res/ext functions/json && npm run build-aot"
functions="functions"
environment={ BACKEND_URL=".netlify/functions/" }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment