Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
example: update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Oct 15, 2024
1 parent ecac521 commit ec77a08
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/internal/playground/functions/apiv2/index.ts
Original file line number Diff line number Diff line change
@@ -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),
};
};
11 changes: 11 additions & 0 deletions examples/internal/playground/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit ec77a08

Please sign in to comment.