-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
169 lines (155 loc) · 4.13 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
service: notes-api
frameworkVersion: "3"
configValidationMode: error
provider:
name: aws
runtime: nodejs18.x
region: us-east-1
tags:
serviceName: notes-api
stage: dev
httpApi:
cors: true
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- Fn::GetAtt: [NotesDynamoDBTable, Arn]
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
Resource:
- Fn::GetAtt: [NotesDynamoDBTable, Arn]
- arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.noteTableName}/index/*
environment:
NOTES_TABLE_NAME: "${self:custom.noteTableName}"
APP_DOMAIN: 'localhost:3000'
SUPABASE_URL: "https://kjosizddxhvvsajpuoxl.supabase.co"
SUPABASE_JWT_SECRET: '${ssm:supabase_jwt_key}'
SUPABASE_KEY: '${ssm:supabase_key}'
SUPABASE_SECRET_KEY: '${ssm:supabase_secret_key}'
custom:
userPoolName: "${self:provider.stage}-notes-api"
noteTableName: "${self:service}-notes-table"
userPoolClientName: "${self:custom.userPoolName}-client"
readCapacity: 3
writeCapacity: 3
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
resources:
Resources:
NotesDynamoDBTable:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
- AttributeName: noteId
AttributeType: S
- AttributeName: status
AttributeType: S
KeySchema:
- AttributeName: userId
KeyType: HASH
- AttributeName: noteId
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: noteStatus
KeySchema:
- AttributeName: status
KeyType: HASH
- AttributeName: userId
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 3
WriteCapacityUnits: 3
ProvisionedThroughput:
ReadCapacityUnits: 3
WriteCapacityUnits: 3
TableName: ${self:custom.noteTableName}
functions:
get-notes:
handler: src/notes/handlers/get-notes.handler
events:
- httpApi:
path: /notes
method: get
create-note:
handler: src/notes/handlers/create-note.handler
events:
- httpApi:
path: /notes
method: post
get-note:
handler: src/notes/handlers/get-note.handler
events:
- httpApi:
path: /notes/{id}
method: get
delete-note:
handler: src/notes/handlers/delete-note.handler
events:
- httpApi:
path: /notes/{id}
method: delete
change-note-status:
handler: src/notes/handlers/change-note-status.handler
events:
- httpApi:
path: /notes/{id}/status
method: patch
update-note:
handler: src/notes/handlers/update-note.handler
events:
- httpApi:
path: /notes/{id}
method: put
create-account:
handler: src/auth/handlers/register.handler
events:
- httpApi:
path: /auth/register
method: post
login:
handler: src/auth/handlers/login.handler
events:
- httpApi:
path: /auth/login
method: post
loginWithSocial:
handler: src/auth/handlers/login-with-social.handler
events:
- httpApi:
path: /auth/social-login
method: post
getUser:
handler: src/auth/handlers/get-user.handler
events:
- httpApi:
path: /auth/user
method: get
forgot-password:
handler: src/auth/handlers/forgot-password.handler
events:
- httpApi:
path: /auth/forgot-password
method: post
reset-password:
handler: src/auth/handlers/reset-password.handler
events:
- httpApi:
path: /auth/reset-password
method: post
plugins:
- serverless-webpack
- serverless-offline