rhythmic-fireman-45324
01/27/2021, 3:36 PMbrave-planet-10645
01/27/2021, 3:42 PMrhythmic-fireman-45324
01/27/2021, 4:00 PMconst endpoint = new awsx.apigateway.API("main", {
routes: [
{
path: "/hello",
method: "GET",
eventHandler: handler(async (_e, _ctx, _cb) => {
dosomething
}),
},
],
});
brave-planet-10645
01/27/2021, 4:08 PMCallbackFunction
which can contains the layers
property that you can use to pass in the ARN for up to 5 layers.
Take a look at this link: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/awsx/apigateway/#event-handler-route and scroll down to the code example with the new aws.lambda.CallbackFunction
method in itimport * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
let endpoint = new awsx.apigateway.API("example", {
routes: [{
path: "/",
method: "GET",
eventHandler: new aws.lambda.CallbackFunction("test", {
memorySize: 256,
layers: [],
callback: async (event) => {
return {
statusCode: 200,
body: "<h1>Hello world!</h1>",
};
},
}),
}],
})
rhythmic-fireman-45324
01/27/2021, 4:35 PMbrave-planet-10645
01/27/2021, 4:36 PM