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

fix netlify deploy

parent 18a17ad6
No related branches found
No related tags found
No related merge requests found
const fs = require('fs')
const path = require('path')
exports.handler = (ev, ctx, cb) => {
const {
......@@ -18,16 +21,34 @@ exports.handler = (ev, ctx, cb) => {
'allenMouse'
]
const resp = {
templates,
ev
const resp = templates
const re = /templates\/(.+)$/.exec(path)
if (re) {
const templateName = re[1]
fs.readFile(`./json/${templateName}.json`, 'utf-8', (err, data) => {
if (err) {
return cb(null, {
status: 500,
body: err.toString()
})
}
return cb(null, {
status: 200,
body: data,
headers: {
'Content-type': 'application/json'
}
})
})
} else {
cb(null, {
status: 200,
body: JSON.stringify(resp),
headers: {
'Content-type': 'application/json'
}
})
}
cb(null, {
status: 400,
body: JSON.stringify(resp),
headers: {
'Content-type': 'application/json'
}
})
}
\ No newline at end of file
......@@ -2,6 +2,6 @@
[build]
publish="dist/aot/"
command="npm run build-aot"
command="cp -R src/res/ext functions/templates/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