-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
87 lines (82 loc) · 1.8 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
# NOTE: update this with your service name
service: talents
# Create an optimized package for our functions
package:
individually: true
plugins:
- serverless-bundle # Package our functions with Webpack
- serverless-offline
- serverless-dotenv-plugin # Load .env as environment variables
provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-east-1
# To load environment variables externally
# rename env.example to .env and uncomment
# the following line. Also, make sure to not
# commit your .env.
#
#environment:
# SAMPLE_ENV_VAR: ${env:SAMPLE_ENV_VAR}
environment:
tableName: candidates
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Scan
- dynamodb:Query
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
Resource: "arn:aws:dynamodb:us-east-1:*:*"
useDotenv: true
cors: true
cors:
origin: '*'
headers:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
allowCredentials: false
functions:
create:
handler: create.main
events:
- http:
path: candidates
method: post
authorizer: aws_iam
get:
handler: get.main
events:
- http:
path: candidates/{id}
method: get
authorizer: aws_iam
list:
handler: list.main
events:
- http:
path: candidates
method: get
authorizer: aws_iam
update:
handler: update.main
events:
- http:
path: candidates/{id}
method: put
authorizer: aws_iam
delete:
handler: delete.main
events:
- http:
path: candidates/{id}
method: delete
authorizer: aws_iam