-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
39 lines (35 loc) · 880 Bytes
/
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
service: url-shortener
plugins:
- serverless-dotenv-plugin
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
env:
MONGO_URI: ${env:MONGO_URI}
MONGO_DATABASE: ${env:MONGO_DATABASE}
MONGO_COLLECTION: ${env:MONGO_COLLECTION}
ENDPOINT_SECRET: ${env:ENDPOINT_SECRET}
functions:
shorten:
name: ${self:service}-shorten-${self:provider.stage}
handler: src/handlers/shorten.handler
events:
- http:
method: post
path: /s
cors: true
redirect:
name: ${self:service}-redirect-${self:provider.stage}
handler: src/handlers/redirect.handler
events:
- http:
method: get
path: /r/{url}
cors: true
request:
parameters:
paths:
url: true