-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
88 lines (84 loc) · 2.18 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: "Awstark API"
Parameters:
DbUrl:
Type: String
Description: Database URL
ShadowDbUrl:
Type: String
Description: Shadow Database URL
Globals:
Function:
Timeout: 50
Tracing: Active
Runtime: nodejs18.x
Architectures:
- x86_64
MemorySize: 128
CodeUri: ./
Environment:
Variables:
DB_URL: !Ref DbUrl
SHADOW_DB_URL: !Ref ShadowDbUrl
Api:
TracingEnabled: true
Resources:
StatusFunction:
Type: AWS::Serverless::Function
Properties:
Handler: build/handlers/status/isUp.default
Events:
Status:
Type: Api
Properties:
Path: /status
Method: get
Metadata:
BuildMethod: esbuild
BuildProperties:
Format: cjs
Target: "es2020"
EntryPoints:
- src/handlers/status/isUp.ts
UserGetProfileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: build/handlers/user/getProfile.default
Events:
Status:
Type: Api
Properties:
Path: /user
Method: get
Metadata:
BuildMethod: esbuild
BuildProperties:
Format: cjs
Target: "es2020"
EntryPoints:
- src/handlers/user/getProfile.ts
UserRegisterFunction:
Type: AWS::Serverless::Function
Properties:
Handler: build/handlers/user/register.default
Events:
Status:
Type: Api
Properties:
Path: /user
Method: post
Metadata:
BuildMethod: esbuild
BuildProperties:
Format: cjs
Target: "es2020"
EntryPoints:
- src/handlers/user/register.ts
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
Api:
Description: "awstark API"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod"