-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
202 lines (196 loc) · 4.27 KB
/
serverless.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
service: arithmetic-calculator-api
frameworkVersion: "3"
useDotenv: true
custom:
datadog:
site: datadoghq.com
apiKeySecretArn: xxx
#datadog:
# uncomment next line to use datadog forwarder
#forwarder: 'arn::of::datadog::forwarder::lambda'
# enableDDTracing: false # disables default dd-trace.init() in datadog-lambda-js
esbuild:
bundle: true
target: node16
minify: true
sourcemap: true
keepNames: true
#plugins: ./esbuild-plugins.js
#exclude: '*'
#outDir: .build
watch:
pattern: ['src/**/*.ts'] # match only typescript files in src directory
ignore: ['.build/**/*']
#dotenv:
# # default: project root
# path: config/.env.test
# NODE_ENV: test #${env:NODE_ENV}
serverless-offline:
httpPort: 3000
host: 0.0.0.0
plugins:
- serverless-esbuild
- serverless-offline
- serverless-plugin-datadog
provider:
name: aws
runtime: nodejs16.x
deploymentMethod: direct
environment:
NODE_ENV: test #${env:NODE_ENV} #${env:NODE_ENV} ${file(configs.js)}
DD_API_KEY: xxxx
region: us-east-2
# memorySize: 128
apiGateway:
minimumCompressionSize: 1024 # Enable gzip compression for responses > 1 KB
profile: default
stage: test
package:
individually: true
exclude:
- config/.env.stg
- config/.env.pro
- tests/**
- '*.txt'
- '*.yml'
- '*.iml'
- '*.json'
- '*.md'
- '*.zip'
- '*.csv'
- /**
include:
- config/.env.dev
- config/.env.test
- src/**
- package.json
functions:
# user
user_create:
handler: src/users_handler.create
events:
- http:
path: users
method: post
cors: true
user_update:
handler: src/users_handler.update
events:
- http:
path: users/{id}
method: put
cors: true
user_find:
handler: src/users_handler.find
events:
- http:
path: users
method: get
cors: true
user_findOne:
handler: src/users_handler.findOne
events:
- http:
path: users/{id}
method: get
cors: true
user_deleteOne:
handler: src/users_handler.deleteOne
events:
- http:
path: users/{id}
method: delete
cors: true
user_login:
handler: src/users_handler.login
events:
- http:
path: users/login
method: post
cors: true
user_logout:
handler: src/users_handler.logout
events:
- http:
path: users/logout
method: post
cors: true
user_register:
handler: src/users_handler.register
events:
- http:
path: users/register
method: post
cors: true
# operation
operation_create:
handler: src/operations_handler.create
events:
- http:
path: operations
method: post
cors: true
operation_update:
handler: src/operations_handler.update
events:
- http:
path: operations/{id}
method: put
cors: true
operation_find:
handler: src/operations_handler.find
events:
- http:
path: operations
method: get
cors: true
operation_findOne:
handler: src/operations_handler.findOne
events:
- http:
path: operations/{id}
method: get
cors: true
operation_deleteOne:
handler: src/operations_handler.deleteOne
events:
- http:
path: operations/{id}
method: delete
cors: true
# record
record_create:
handler: src/records_handler.create
events:
- http:
path: records
method: post
cors: true
record_update:
handler: src/records_handler.update
events:
- http:
path: records/{id}
method: put
cors: true
record_find:
handler: src/records_handler.find
events:
- http:
path: records
method: get
cors: true
record_findOne:
handler: src/records_handler.findOne
events:
- http:
path: records/{id}
method: get
cors: true
record_deleteOne:
handler: src/records_handler.deleteOne
events:
- http:
path: records/{id}
method: delete
cors: true