-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
57 lines (51 loc) · 1.18 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
# serverless.yml
service: service-with-two-apis
custom:
ALLOWED_ORIGINS:
- http://localhost:3000
- https://mywebsite.example.com
provider:
# REST API configuration
apiGateway:
# Enable gzip compression for responses > 1 KB
minimumCompressionSize: 1024,
# HTTP API configuration
httpApi:
cors:
allowedOrigins: ${self:custom.ALLOWED_ORIGINS}
allowedHeaders:
- Content-Type
- Origin
- Authorization
allowedMethods:
- GET
- POST
- PATCH
- DELETE
- PUT
- OPTIONS
functions:
health:
handler: path/to/handler
events:
# Trigger via REST API
- http:
method: get
path: /actions/list
authorizer:
type: COGNITO_USER_POOLS
authorizerId: restApiAuthorizerId
cors:
origins: ${self:custom.ALLOWED_ORIGINS}
headers:
- Content-Type
- Origin
- Authorization
allowCredentials: false
cacheControl: max-age=600, s-maxage=600, proxy-revalidate
# Trigger via HTTP API
- httpApi:
method: get
path: /actions/list
authorizer:
id: httpApiAuthorizerId