-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
108 lines (98 loc) · 2.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
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
service: carts
frameworkVersion: "2"
# variablesResolutionMode: 20210219
useDotenv: true
plugins:
- serverless-webpack
- serverless-dynamodb-local
- serverless-offline-dotenv
- serverless-offline
custom:
webpack:
webpackConfig: "./webpack.config.js"
includeModules:
forceExclude:
- aws-sdk
packager: "npm"
serverless-offline:
httpPort: 4000
ignoreJWTSignature: true
provider:
name: aws
region: eu-central-1
# profile: swexception
runtime: nodejs12.x
lambdaHashingVersion: "20201221"
stage: ${opt:stage, 'dev'}
apiGateway:
restApiId: 95kq9eggu9
restApiRootResourceId: zsd84g8moe
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
REGION: ${self:provider.region}
SERVICES: ${env:SERVICES}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:*
- s3:*
Resource: "*"
functions:
getCart:
handler: "src/handlers/getCart.HANDLER"
events:
- http:
path: /cart
method: GET
cors: true
deleteCart:
handler: "src/handlers/deleteCart.HANDLER"
events:
- http:
path: /cart/
method: DELETE
cors: true
addToCart:
handler: "src/handlers/addToCart.HANDLER"
events:
- http:
path: /cart/
method: POST
cors: true
updateCart:
handler: "src/handlers/updateCart.HANDLER"
events:
- http:
path: /cart/product/{id}
method: PATCH
cors: true
removeFromCart:
handler: "src/handlers/removeFromCart.HANDLER"
events:
- http:
path: /cart/product/{id}
method: DELETE
cors: true
authCart:
handler: "src/handlers/authCart.HANDLER"
events:
- http:
path: /cart/
method: PATCH
cors: true
resources:
Resources:
#dynamodb tables
CartsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: carts
AttributeDefinitions:
- AttributeName: id
AttributeType: "S"
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST