Serverless api built using Serverless framework
, Lambda functions
, AWS API Gateway Proxy
and NodeJS
.This API uses MongoDB
as a database for all CRUD operations.This application is ready to be deployed in AWS Lambda and with Serverless framework its just a command away. Only we need to configure the AWS account settings in the Serverless.YML .
TODO:
1.Authentication
# This will emulate the actual AWS Lambda environment so that we could run and test it in local
sls offline start --port 4500 --skipCacheInvalidation
{get} http://localhost:4500/api/ : This will fetch all the products from MongoDB with a rate limiter.
{post} http://localhost:4500/api/ : This endpoint will allow user to add products. Request should be made with respect to proper Json contract.
# contract example
{
"name": "iphone",
"description": "Apple iphone",
"price": 70000,
"ispublished": true
}
{put} http://localhost:4500/api/{id} : This endpoint will allow user to update products. Request should be made with respect to proper Json contract.
{delete} http://localhost:4500/api/courses/ : This will allow user to delete products from MongoDB
Some of non-standard modules used: