-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
53 lines (50 loc) · 1.17 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
service: my-api
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, "dev"} # overriden by serverless --stage xxxx
region: eu-central-1
environment:
# Try to fetch MY_API_MONGODB_URL_xxxx from SSM.
# Use "mongodb://localhost:27017" if the above doesn't exist
MONGODB_URL: ${ssm:MY_API_MONGODB_URL_${self:provider.stage}~true, "mongodb://localhost:27017/test"}
functions:
listUsers:
handler: handlers/users.list
events:
- http:
path: /users
method: get
cors: true
getUser:
handler: handlers/users.get
events:
- http:
path: /users/{id+}
method: get
cors: true
addUser:
handler: handlers/users.add
events:
- http:
path: /users
method: post
cors: true
updateUser:
handler: handlers/users.update
events:
- http:
path: /users/{id+}
method: put
cors: true
removeUser:
handler: handlers/users.remove
events:
- http:
path: /users
method: delete
cors: true
plugins:
- serverless-webpack
- serverless-offline
- serverless-mocha-plugin