diff --git a/docs/02-providers/aws/examples/web-serving-html/node/README.md b/docs/02-providers/aws/examples/web-serving-html/node/README.md index d00940403..8bbfe1b53 100644 --- a/docs/02-providers/aws/examples/web-serving-html/node/README.md +++ b/docs/02-providers/aws/examples/web-serving-html/node/README.md @@ -4,6 +4,6 @@ menuText: Serving Static HTML layout: Doc --> -# Serving Static HTML with NodeJS + APIGateway +# Serving Static HTML with NodeJS + API Gateway -This is an example of serving vanilla HTML/CSS/JS through API-gateway \ No newline at end of file +This is an example of serving vanilla HTML/CSS/JS through API Gateway \ No newline at end of file diff --git a/docs/02-providers/aws/examples/web-serving-html/node/handler.js b/docs/02-providers/aws/examples/web-serving-html/node/handler.js index 526c9a4a0..914016966 100644 --- a/docs/02-providers/aws/examples/web-serving-html/node/handler.js +++ b/docs/02-providers/aws/examples/web-serving-html/node/handler.js @@ -2,12 +2,13 @@ // Your function handler module.exports.staticHtml = function (event, context, callback) { - var defaultEmptyHTML = '' - var dynamicHtml = defaultEmptyHTML + let dynamicHtml; /* check for GET params and use if available */ - if(event.query && event.query.name) { + if (event.queryStringParameters && event.queryStringParameters.name) { // yourendpoint.com/dev/landing-page?name=bob - dynamicHtml = `
Hey ${event.query.name}
` + dynamicHtml = `Hey ${event.queryStringParameters.name}
`; + } else { + dynamicHtml = ''; } const html = ` @@ -19,10 +20,15 @@ module.exports.staticHtml = function (event, context, callback) {