-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
189 lines (166 loc) · 4.51 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
service: e-commerce-app
frameworkVersion: '2 || 3'
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
region: us-east-1
stage: ${opt:stage, 'prod'}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:*:*:table/*"
environment:
# Adicionar em um .env
ACCESS_TOKEN_SECRET: "64b4f06dd78f4607c35aa19c246db9f05e1ee40b5acf4d8503e1c642010fbff65e53086bb6c95d72fbcb0cd2906cb385095a0849964956c953d2b2d51eaf4c85" # dummy token
TWILIO_ACCOUNT_SID: "ACd0a4bc51d9309c29f33bde6c7c196b1e" # dummy token
TWILIO_AUTH_TOKEN: "b7542d24dbb0aa1b106e37885499fdd7" # dummy token
plugins:
- serverless-dynamodb-local
- serverless-offline
package:
excludeDevDependencies: true
exclude:
- .git/**
- .test/**
- .github/**
functions:
notFound:
handler: src/shared/notFound.notFound
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/{proxy+}
method: any
cors: true
createOrders:
handler: src/api/${self:custom.version}/orders/create.create
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/orders
method: post
cors: true
readOrders:
handler: src/api/${self:custom.version}/orders/read.read
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/orders
method: get
cors: true
readOrdersById:
handler: src/api/${self:custom.version}/orders/read.readById
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/orders/{id}
method: get
cors: true
updateOrders:
handler: src/api/${self:custom.version}/orders/update.update
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/orders/{id}
method: put
cors: true
deleteOrders:
handler: src/api/${self:custom.version}/orders/delete.delete
timeout: 30
# authorizer: authorizerAccess
events:
- http:
path: ${self:custom.version}/orders/{id}
method: delete
cors: true
createCredentials:
handler: src/api/${self:custom.version}/auth/create.create
timeout: 30
events:
- http:
path: ${self:custom.version}/credential
method: post
cors: true
firstLoginStep:
handler: src/api/${self:custom.version}/auth/firstLoginStep.firstLoginStep
timeout: 30
events:
- http:
path: ${self:custom.version}/credential/login
method: post
cors: true
secondLoginStep:
handler: src/api/${self:custom.version}/auth/secondLoginStep.secondLoginStep
timeout: 30
events:
- http:
path: ${self:custom.version}/credential/login/two-step
method: post
cors: true
# authorizerAccess:
# handler: src/api/${self:custom.version}/auth/authorizerAccess.authorizerAccess
resources:
Resources:
ordersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.stage}OrdersTable
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
credentialsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.stage}CredentialsTable
AttributeDefinitions:
- AttributeName: partitionKey
AttributeType: S
- AttributeName: sortKey
AttributeType: S
KeySchema:
- AttributeName: partitionKey
KeyType: HASH
- AttributeName: sortKey
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
custom:
serverless-offline:
host: '0.0.0.0'
dynamodb:
stages:
- local
- dev
- prod
start:
host: dynamo
port: 8000
inMemory: true
heapInitial: 200m
heapMax: 1g
migrate: true
seed: true
convertEmptyValues: true
noStart: true
version: ${opt:version, 'v1'}