-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
168 lines (151 loc) · 4.55 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
service: node-aws-lambda-example-hello-world
plugins:
- serverless-domain-manager
- serverless-v2-aws-documentation
- serverless-jetpack
- serverless-offline
provider:
name: aws
runtime: nodejs20.x
memorySize: 512
profile: serverless
stage: dev
region: us-east-1
lambdaHashingVersion: 20201221
logs:
restApi: true
tracing:
apiGateway: true
lambda: true
environment:
DEBUG: ${self:custom.environment.debugLog}
NODE_ENV: ${self:custom.environment.nodeEnvironment}
custom:
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
domainName: ${self:custom.domainNameStage.${self:custom.stage}}
domainNameStage:
dev: 'localhost:${self:custom.serverless-offline.httpPort}'
test: test-api.${self:custom.baseDomainName}
prod: api.${self:custom.baseDomainName}
baseDomainName: codesaplings.com
customDomain:
domainName: ${self:custom.domainName}
certificateName: ${self:custom.domainName}
basePath: hello
stage: ${self:custom.stage}
createRoute53Record: true
serverless-offline:
httpPort: '3000'
websocketPort: '3001'
lambdaPort: '3002'
environment:
debugLog: ${self:custom.environment.debugLogStage.${self:custom.stage}}
debugLogStage:
dev: 'sapling-hello-world:*,-*:trace'
test: 'sapling-hello-world:*,-*:trace'
prod: 'sapling-hello-world:*,-*:trace'
nodeEnvironment: ${self:custom.environment.nodeEnvironmentStage.${self:custom.stage}}
nodeEnvironmentStage:
dev: development
test: test
prod: production
documentation:
info:
title: Hello World!
description: Simple function to return a nice message
version: 1.0.0
models:
- name: DataInput
description: Data input for the application
contentType: application/json
schema:
type: object
properties:
word:
type: string
description: Word to be used in the message
- name: DataOutput
description: Response message
contentType: application/json
schema:
type: string
- name: ErrorResponse
description: Error response from the application
contentType: application/json
schema:
type: object
properties:
error:
type: string
description: Error message
package:
individually: false
exclude:
- .circleci/**
- .github/**
- .idea/**
- .env*
- examples/**
- scripts/**
- spec/**
- tmp/**
- '**/node_modules/aws-sdk/**'
functions:
helloWorld:
handler: dist/events/helloWorld.handler
events:
- http:
path: /
method: get
cors: true
documentation:
summary: Get a hello message
description: Returns a JSON string with a nice message
queryParams:
- name: word
in: query
description: A word to use in the message
required: false
type: string
methodResponses:
- statusCode: '200'
responseBody:
description: Successful operation
responseModels:
'application/json': DataOutput
- statusCode: '400'
responseBody:
description: Invalid input provided
responseModels:
'application/json': ErrorResponse
- statusCode: '500'
responseBody:
description: Unhandled error
responseModels:
'application/json': ErrorResponse
- http:
path: /
method: post
cors: true
documentation:
summary: Produce a hello message
description: Returns a JSON string with a nice message
requestModels:
'application/json': DataInput
methodResponses:
- statusCode: '200'
responseBody:
description: Successful operation
responseModels:
'application/json': DataOutput
- statusCode: '400'
responseBody:
description: Invalid input provided
responseModels:
'application/json': ErrorResponse
- statusCode: '500'
responseBody:
description: Unhandled error
responseModels:
'application/json': ErrorResponse