Skip to content

Instantly share code, notes, and snippets.

@loloDawit
Last active March 21, 2021 18:12
Show Gist options
  • Save loloDawit/d056a92584355394724c275b6fc0ac75 to your computer and use it in GitHub Desktop.
Save loloDawit/d056a92584355394724c275b6fc0ac75 to your computer and use it in GitHub Desktop.
Serverless config
service: serverless-restapi
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs14.x
stage: ${opt:stage}
region: us-east-1
lambdaHashingVersion: 20201221
# add 5 function for CURD operation
functions:
create:
handler: handler.create
events:
- http:
path: notes
method: post
cors: true
getOne:
handler: handler.getOne
events:
- http:
path: notes/{id}
method: get
cors: true
getAll:
handler: handler.getAll
events:
- http:
path: notes
method: get
cors: true
update:
handler: handler.update
events:
- http:
path: notes/{id}
method: put
cors: true
delete:
handler: handler.delete
events:
- http:
path: notes/{id}
method: delete
cors: true
plugins:
- serverless-offline # adding the plugin to be able to run the offline emulation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment