Repository navigation
Expand file tree
/
Copy pathserverless.yml
More file actions
84 lines (75 loc) · 1.92 KB
/
Copy pathserverless.yml
File metadata and controls
84 lines (75 loc) · 1.92 KB
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
service: lambda-customers-api
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs18.x
environment:
CUSTOMER_TABLE: 'customers'
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
Resource: "*"
plugins:
- serverless-offline
resources:
Resources:
CustomersDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Delete
Properties:
TableName: ${self:provider.environment.CUSTOMER_TABLE}
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
functions:
createCustomer:
handler: dist/src/main/routes/customers/create-customer.router
description: Create a new customer.
events:
- http:
path: customers
method: post
listCustomers:
handler: dist/src/main/routes/customers/list-customer.router
description: List all customers.
events:
- http:
path: customers
method: get
request:
parameters:
querystrings:
search: true
findCustomer:
handler: dist/src/main/routes/customers/find-customer.router
description: Find a customer by ID.
events:
- http:
path: customers/{id}
method: get
updateCustomer:
handler: dist/src/main/routes/customers/update-customer.router
description: Update a customer by ID.
events:
- http:
path: customers/{id}
method: put
deleteCustomer:
handler: dist/src/main/routes/customers/delete-customer.router
description: Delete a customer by ID.
events:
- http:
path: customers/{id}
method: delete