forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
42 lines (38 loc) · 1.02 KB
/
index.ts
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
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as awsx from "@pulumi/awsx";
import handler from "./handler";
/**
* api-gatewayx https://www.pulumi.com/docs/guides/crosswalk/aws/api-gateway/
*/
// Create an API endpoint.
const endpoint = new awsx.apigateway.API("hello-world", {
routes: [
{
path: "/{route+}",
method: "GET",
// Functions can be imported from other modules
eventHandler: handler,
},
{
path: "/{route+}",
method: "POST",
// Functions can be created inline
eventHandler: (event) => {
console.log("Inline event handler");
console.log(event);
},
},
{
path: "/{route+}",
method: "DELETE",
// Functions can be created inline
eventHandler: (event) => {
console.log("Inline delete event handler");
console.log(event);
},
},
],
});
// Pulumi exports values
// See these outputs using: pulumi stack output endpointUrl
export const endpointUrl = endpoint.url;