/
hello.js
30 lines (24 loc) · 847 Bytes
/
hello.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* This is a serverless function which runs in AWS Lambda.
* It is deployed via Netlify so that building, versioning
* and deploying is easier than it might be otherwise.
*
* No need to configure AWS, just include a file like this in
* your code, and deploy as you would any other site on Netlify.
*
* https://www.netlify.com/docs/functions/
*/
'use strict';
// A standard Lambda function handler
export function handler(event, context, callback) {
// Who's there?
const name = event.queryStringParameters["name"] || "friend"
// Say hello
callback(null, {
statusCode: 200,
headers: { "Content-Type": "text/html" },
body: `<html>Hello from a serverless
<a href="https://github.com/philhawksworth/hawksworx.com/blob/master/src/lambda/hello.js">function</a>,
<em>${name}!</em></html>`
});
}