Skip to content

Instantly share code, notes, and snippets.

@louislatreille
Created April 3, 2022 00:50
Show Gist options
  • Save louislatreille/946bd904ebf492f46e87787f213c0ecd to your computer and use it in GitHub Desktop.
Save louislatreille/946bd904ebf492f46e87787f213c0ecd to your computer and use it in GitHub Desktop.
pulumiServerlessJourney - index.ts
import * as apigateway from "@pulumi/aws-apigateway";
import * as aws from "@pulumi/aws";
export const api = new apigateway.RestAPI("pulumi-serverless-journey", {
stageName: "dev",
routes: [
{
path: "/function1",
method: "POST",
eventHandler: new aws.lambda.CallbackFunction("function1", {
callback: async () => {
console.log("Hello from function 1!");
return {
statusCode: 200,
};
},
}),
},
{
path: "/function2",
method: "POST",
eventHandler: new aws.lambda.CallbackFunction("function2", {
callback: async () => {
console.log("Hello from function 2!");
return {
statusCode: 200,
};
},
}),
},
{
path: "/function3",
method: "POST",
eventHandler: new aws.lambda.CallbackFunction("function3", {
callback: async () => {
console.log("Hello from function 3!");
return {
statusCode: 200,
};
},
}),
},
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment