-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
94 lines (88 loc) · 2.43 KB
/
template.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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: SAM Template for Form Builder application backend
Globals:
Function:
Handler: app.lambdaHandler
Runtime: nodejs18.x
Architectures:
- x86_64
Timeout: 15
Environment:
Variables:
# Replace <username>, <password> and <clusterName> with the real values before the deployment or local testing
mongoUrl: mongodb+srv://<username>:<password>@<clusterName>.mongodb.net/?retryWrites=true&w=majority&srvMaxHosts=3
Api:
Cors:
AllowMethods: "'OPTIONS,POST,GET,PUT,PATCH'"
AllowHeaders: "'Content-Type,Authorization'"
AllowOrigin: "'*'"
Resources:
FormBuilderApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
RegisterFunction:
Type: AWS::Serverless::Function
CodeUri: functions/register
Properties:
FunctionName: FB-register
Events:
RegisterUser:
Type: Api
Properties:
RestApiId: !Ref FormBuilderApi
Path: /users/register
Method: post
Metadata:
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: es2020
Sourcemap: true
EntryPoints:
- functions/register/app.ts
FormCreateFunction:
Type: AWS::Serverless::Function
CodeUri: functions/formCreate
Properties:
FunctionName: FB-formCreate
Events:
CreateForm:
Type: Api
Properties:
RestApiId: !Ref FormBuilderApi
Path: /forms
Method: post
Metadata:
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: es2020
Sourcemap: true
EntryPoints:
- functions/formCreate/app.ts
FormListFunction:
Type: AWS::Serverless::Function
CodeUri: functions/formList
Properties:
FunctionName: FB-formList
Events:
CreateForm:
Type: Api
Properties:
RestApiId: !Ref FormBuilderApi
Path: /forms
Method: get
Metadata:
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: es2020
Sourcemap: true
EntryPoints:
- functions/formList/app.ts
Outputs:
FormBuilderApi:
Description: API Gateway endpoint URL for Prod stage of Form Builder app
Value: !Sub "https://${FormBuilderApi}.execute-api.${AWS::Region}.amazonaws.com/Prod"