-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
71 lines (66 loc) · 1.92 KB
/
template.yaml
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
# https://github.com/awslabs/serverless-application-model/blob/develop/versions/2016-10-31.md
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: user-api
Globals:
Function:
Timeout: 60
Resources:
PrismaLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: PrismaLayer
ContentUri: src/layers/prisma/dist/
CompatibleRuntimes:
- nodejs14.x
RetentionPolicy: Retain
Metadata:
BuildMethod: nodejs14.x
LibsLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: LibsLayer
ContentUri: src/layers/libs/dist/
CompatibleRuntimes:
- nodejs14.x
RetentionPolicy: Retain
Metadata:
BuildMethod: nodejs14.x
CreateUserFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler.default
CodeUri: src/handlers/createUser/dist/
Layers:
- !Ref PrismaLayer
- !Ref LibsLayer
Runtime: nodejs14.x
Events:
Add:
Type: Api
Properties:
Path: /user
Method: post
Environment:
Variables:
DATABASE_URL: postgres://USERNAME:PASSWORD@HOSTNAME:5432/DATABASENAME
PRISMA_QUERY_ENGINE_LIBRARY: /opt/nodejs/node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node
ListUsersFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler.default
CodeUri: src/handlers/listUsers/dist/
Layers:
- !Ref PrismaLayer
- !Ref LibsLayer
Runtime: nodejs14.x
Events:
Sub:
Type: Api
Properties:
Path: /users
Method: get
Environment:
Variables:
DATABASE_URL: postgres://USERNAME:PASSWORD@HOSTNAME:5432/DATABASENAME
PRISMA_QUERY_ENGINE_LIBRARY: /opt/nodejs/node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node