-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
30 lines (27 loc) · 875 Bytes
/
Copy pathindex.ts
File metadata and controls
30 lines (27 loc) · 875 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
import * as aws from "@pulumi/aws";
import * as awsx from "@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.
export const url = api.url;