Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
link to docs in hello world function template
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-yx committed Jun 12, 2019
1 parent e760e34 commit 42dada8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/functions-templates/js/hello-world/hello-world.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// Docs on event and context https://www.netlify.com/docs/functions/#the-handler-method
exports.handler = async (event, context) => {
try {
const subject = event.queryStringParameters.name || "World";
return { statusCode: 200, body: `Hello ${subject}` };
return {
statusCode: 200,
body: JSON.stringify({ message: `Hello ${subject}` })
// // more keys you can return:
// headers: { "headerName": "headerValue", ... },
// isBase64Encoded: true,
};
} catch (err) {
return { statusCode: 500, body: err.toString() };
}
Expand Down

0 comments on commit 42dada8

Please sign in to comment.