-
Notifications
You must be signed in to change notification settings - Fork 10
/
serverless.yml
68 lines (65 loc) · 1.63 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
org: tmaximini
custom:
secrets: ${file(secrets.json)}
tableName: "test-users-table"
service: serverless-jwt-authorizer
provider:
name: aws
runtime: nodejs12.x
region: eu-central-1
environment:
JWT_SECRET: ${self:custom.secrets.JWT_SECRET}
AWS_ID: ${self:custom.secrets.AWS_ID}
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
- "dynamodb:PutItem"
Resource: "arn:aws:dynamodb:eu-central-1:${self:custom.secrets.AWS_ID}:table/${self:custom.tableName}"
functions:
verify-token:
handler: functions/authorize.handler
me:
handler: functions/me.handler
events:
- http:
path: me
method: get
cors: true
authorizer:
name: verify-token
identitySource: method.request.header.Authorization
resultTtlInSeconds: 3600
login:
handler: functions/login.handler
events:
- http:
path: login
method: post
cors: true
register:
handler: functions/register.handler
events:
- http:
path: register
method: post
cors: true
resources:
Resources:
usersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: sk
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1