-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (28 loc) · 884 Bytes
/
Copy pathindex.js
File metadata and controls
31 lines (28 loc) · 884 Bytes
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
31
"use strict";
const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");
const payload =
'<img src="https://cultofthepartyparrot.com/parrots/hd/revolutionparrot.gif">';
// Provision an API Gateway instance.
const api = new awsx.classic.apigateway.API("serverless-party-parrot", {
routes: [
{
// Define an HTTP endpoint.
path: "/",
method: "GET",
// Create a Lambda function that will be triggered upon accessing this endpoint.
eventHandler: new aws.lambda.CallbackFunction("handler", {
callback: async (event) => {
// Cry havoc and let slip the parrots of war.
return {
statusCode: 200,
headers: { "Content-Type": "text/html" },
body: payload,
};
},
}),
},
],
});
// The URL of the deployed serverless webpage.
exports.url = api.url;