Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eladcon committed Apr 10, 2024
1 parent 6926a94 commit dbec284
Show file tree
Hide file tree
Showing 6 changed files with 9,655 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/tsoa-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
36 changes: 36 additions & 0 deletions examples/tsoa-app/backend/main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
bring cloud;
bring tsoa;
bring aws;
bring util;

// create a AWS function
if util.env("WING_TARGET") == "tf-aws" {
bring "cdktf" as cdktf;
let getTeamByPlayerId = new cloud.Function(inflight (payload) => {
if let playerId = payload {
if num.fromStr(playerId) % 2 == 0 {
return "Blue Team";
} else {
return "Red Team";
}
}

return "Green Team";
});

new cdktf.TerraformOutput(value: aws.Function.from(getTeamByPlayerId)?.functionArn);
} else {
let playersStore = new cloud.Bucket();
let service = new tsoa.Service(
controllerPathGlobs: ["../src/*Controller.ts"],
outputDirectory: "../build",
routesDir: "../build"
);

service.liftClient("playersStore", playersStore, ["tryGet", "put"]);

// get the function ARN after deploying it
let getTeamByPlayerId = new aws.FunctionRef("") as "getTeamByPlayerId";
service.liftClient("getTeamByPlayerId", getTeamByPlayerId, ["invoke"]);
}

Loading

0 comments on commit dbec284

Please sign in to comment.