-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
110 lines (93 loc) · 2.39 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
# Welcome to serverless. Read the docs
# https://serverless.com/framework/docs/
# Serverless.yml is the configuration the CLI
# uses to deploy your code to your provider of choice
# The `service` block is the name of the service
service: movies-api
frameworkVersion: '3'
useDotenv: true
plugins:
# https://www.serverless.com/plugins/serverless-plugin-typescript - typescript must precede offline
- serverless-esbuild
- serverless-offline
custom:
esbuild:
bundle: true
minify: false
package:
individually: true
# The `provider` block defines where your service will be deployed
provider:
name: aws
profile: moviesApi
deploymentMethod: direct
runtime: nodejs18.x
memorySize: 512
timeout: 10
environment:
CONTENTFUL_SPACE_ID: ${env:CONTENTFUL_SPACE_ID}
CONTENTFUL_DELIVERY_API_TOKEN: ${env:CONTENTFUL_DELIVERY_API_TOKEN}
CONTENTFUL_CONTENT_MANAGEMENT_API_TOKEN: ${env:CONTENTFUL_CONTENT_MANAGEMENT_API_TOKEN}
httpApi:
cors: true
tracing:
apiGateway: true
lambda: true
# The `functions` block defines what code to deploy
functions:
getValidToken:
handler: src/handlers/auth/getValidToken.handler
events:
- httpApi:
path: /auth/token
method: get
# healthcheck - check status of the app
healthcheck:
handler: src/handlers/healthcheck.handler
events:
- httpApi:
path: /healthcheck
method: get
# graphql
graphql:
handler: src/handlers/graphql.server
events:
- httpApi:
path: /graphql
method: post
- httpApi:
path: /graphql
method: get
environment:
SLS_STAGE: ${sls:stage}
# RESTful APIs
moviesByGenre:
handler: src/handlers/genres/moviesByGenre.handler
events:
- httpApi:
path: /genres/movies
method: get
movies:
handler: src/handlers/movies/getMovies.handler
events:
- httpApi:
path: /movies
method: get
movieById:
handler: src/handlers/movies/movieById.handler
events:
- httpApi:
path: /movies/{id}
method: get
movieTitles:
handler: src/handlers/movies/getMovieTitles.handler
events:
- httpApi:
path: /movies/titles
method: get
genreById:
handler: src/handlers/genres/genreById.handler
events:
- httpApi:
path: /movies/genres/{id}
method: get