-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
67 lines (62 loc) · 1.45 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
service: brevis
tenant: orthodoz
app: brevis-app
org: orthodoz
package:
individually: true
plugins:
- serverless-webpack
- serverless-dotenv-plugin
- serverless-offline
custom:
webpack:
includeModules: true
packager: 'npm'
excludeFiles: src/**/*.spec.js
serverless-offline:
port: 4000
printOutput: true
showDuration: true
skipCacheInvalidation: true
provider:
name: aws
runtime: nodejs12.x
stage: prod
region: us-east-1
apiGateway:
minimumCompressionSize: 1024 # Enable gzip compression for responses > 1 KB
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
MONGODB_CONNECTION_STRING: ${param:MONGODB_CONNECTION_STRING}
functions:
createShortUrlByHash:
handler: src/handler.createShortUrlByHash
events:
- http:
path: hash
method: POST
cors: true
getUrlByHash:
handler: src/handler.getUrlByHash
events:
- http:
path: url
method: GET
cors: true
getStatsByUrl:
handler: src/handler.getStatsByUrl
events:
- http:
path: stats/url
method: post
cors: true
cleanup:
handler: src/handler.cleanup
events:
- schedule:
name: cleanup-expired-hashes
description:
'Create cronjob which will delete every day at 12.00am hashes of
URLs which are not longer used by 12 months.'
enabled: true
rate: cron(0 0 * * ? *)