-
Notifications
You must be signed in to change notification settings - Fork 50
/
serverless.yml
131 lines (117 loc) · 3.94 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
service: serverless-sample
provider:
name: aws
runtime: nodejs6.10
stage: demo
region: us-east-1
iamRoleStatements:
- Effect: "Allow"
Action:
- "apigateway:GET"
Resource:
- "arn:aws:apigateway:${self:provider.region}::/restapis*"
plugins:
- serverless-plugin-typescript
- serverless-offline
- serverless-aws-documentation
- serverless-domain-manager
- serverless-stack-output
package:
include:
src/**/!(*.spec).js
exclude:
- node_modules/**/*
functions:
getSwaggerJson:
handler: src/swagger/swagger.getSwaggerJson
description: Returns the Swagger documentation of the API in JSON format.
environment:
REGION_NAME: ${self:provider.region}
REST_API_NAME: ${self:service}
STAGE_NAME: ${self:provider.stage}
API_INFO_VERSION: ${file(./swagger/documentation.yml):api.info.version}
API_INFO_TITLE: ${file(./swagger/documentation.yml):api.info.title}
events:
- http:
path: swagger.json
method: get
cors: true
getHealthCheck:
handler: src/health/health.getHealthCheck
description: Returns the result of a quick health check of the API.
events:
- http:
path: health/check
method: get
cors: true
documentation:
summary: Returns the result of a quick health check of the API.
tags:
- Health
description: Returns the result of a quick health check of the API.
methodResponses:
- statusCode: '200'
description: Returned when the operation is completed successfully.
responseModels:
"application/json": GetHealthCheck
- ${file(./swagger/error-responses/internal-server-error.yml)}
getHealthCheckDetailed:
handler: src/health/health.getHealthCheckDetailed
description: Returns the result of a detailed health check of the API.
events:
- http:
path: health/detailed
method: get
cors: true
documentation:
summary: Returns the result of a detailed health check of the API.
tags:
- Health
description: Returns the result of a detailed health check of the API.
methodResponses:
- statusCode: '200'
description: Returned when the operation is completed successfully.
responseModels:
"application/json": GetHealthCheckDetailed
- ${file(./swagger/error-responses/internal-server-error.yml)}
getCity:
handler: src/cities/cities.getCity
description: Returns a single city.
environment:
DEFAULT_COUNTRY: Hungary
events:
- http:
path: cities/{id}
method: get
cors: true
request:
parameters:
paths:
id: true
documentation:
summary: Get a city.
tags:
- City
description: Returns the specified city.
pathParams:
- name: id
description: The unique identifier of the city to retrieve.
methodResponses:
- statusCode: '200'
description: Returned when the operation is completed successfully.
responseModels:
"application/json": GetCityResponse
- ${file(./swagger/error-responses/bad-request.yml)}
- ${file(./swagger/error-responses/forbidden.yml)}
- ${file(./swagger/error-responses/not-found.yml)}
- ${file(./swagger/error-responses/internal-server-error.yml)}
custom:
documentation: ${file(./swagger/documentation.yml)}
customDomain:
basePath: "api"
domainName: serverless-sample.balassy.me
certificateName: serverless-sample.balassy.me
stage: ${self:provider.stage}
createRoute53Record: true
output:
file: .serverless/output.json