diff --git a/examples/internal/playground/functions/apiv2/index.ts b/examples/internal/playground/functions/apiv2/index.ts new file mode 100644 index 000000000..c85c858bc --- /dev/null +++ b/examples/internal/playground/functions/apiv2/index.ts @@ -0,0 +1,8 @@ +import { Resource } from "sst"; + +export const handler = async (event) => { + return { + statusCode: 200, + body: JSON.stringify({ event, resources: Resource.MyBucket }, null, 2), + }; +}; diff --git a/examples/internal/playground/sst.config.ts b/examples/internal/playground/sst.config.ts index d4a1f2140..9668558d4 100644 --- a/examples/internal/playground/sst.config.ts +++ b/examples/internal/playground/sst.config.ts @@ -13,6 +13,7 @@ export default $config({ const vpc = addVpc(); const bucket = addBucket(); + //const apiv2 = addApiV2(); //const app = addFunction(); //const service = addService(); //const cron = addCron(); @@ -41,6 +42,16 @@ export default $config({ return cron; } + function addApiV2() { + const api = new sst.aws.ApiGatewayV2("MyApiV2", { + link: [bucket], + }); + api.route("GET /", { + handler: "functions/apiv2/index.handler", + }); + return api; + } + function addFunction() { const app = new sst.aws.Function("MyApp", { handler: "functions/handler-example/index.handler",