add netlify function

This commit is contained in:
koehr 2022-01-22 15:58:03 +01:00
parent db2c9bcd36
commit bb8accf537
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,17 @@
// Docs on event and context https://www.netlify.com/docs/functions/#the-handler-method
const handler = async (event) => {
try {
const subject = event.queryStringParameters.name || 'World'
return {
statusCode: 200,
body: JSON.stringify({ message: `Hello ${subject}` }),
// // more keys you can return:
// headers: { "headerName": "headerValue", ... },
// isBase64Encoded: true,
}
} catch (error) {
return { statusCode: 500, body: error.toString() }
}
}
module.exports = { handler }

3
netlify.toml Normal file
View file

@ -0,0 +1,3 @@
[build]
publish = "dist"
functions = "functions"