From 42dada89030aa5099005020a783704be0f8aa499 Mon Sep 17 00:00:00 2001 From: sw-yx Date: Wed, 12 Jun 2019 14:57:58 -0400 Subject: [PATCH] link to docs in hello world function template --- src/functions-templates/js/hello-world/hello-world.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/functions-templates/js/hello-world/hello-world.js b/src/functions-templates/js/hello-world/hello-world.js index 40ee645..98ca5fa 100644 --- a/src/functions-templates/js/hello-world/hello-world.js +++ b/src/functions-templates/js/hello-world/hello-world.js @@ -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() }; }