DEV Community

Ali Abbas
Ali Abbas

Posted on

7 2

Serverless AWS Lambda Node Express MongoDB Boilerplate🚀

Serverless-AWS-Lambda-Node-Express-MongoDB Boilerplate🚀

Boilerplate for Creating Restful API using Express.js, Node.js, MongoDB and Setting up on AWS Lambda

Serverless-AWS-Lambda-Node-Express-MongoDb Search Results

  • Prerequisites

    • AWS IAM Role
    • Mongodb Atlas Cloud
    • Serverless Framework
    • Node.js
    • Express.js
    • Mongodb
    • body-parser
    • Serverless-offline
    • loadtest

Installation Steps

In the root directory run the following command:

  • npm install It will save all the dependencies and dev-dependencies present in package.json

Setup the IAM Role and configure the serverless(sls) command line.

Create an account on Mongodb Atlass Cloud and Whitelist the IP Address 0.0.0.0/0. Also create a user in database and setup it in secrets.json

Create Restful API using Express and Node

Deploy the codebase using

sls deploy

for the development stage

For production switch over to

production

in secrets.json

After

sls deploy

. Code will be deployed on AWS Lambda. Head over to AWS Lambda and test it using Postman or Insomnia. After that for scaling test, use

loadtest

and send 100 GET concurrent requests for 10 simulatenous users and watch the latency that comes around to be ~5 seconds.

Cheers! AWS Lambda Auto Scaling with an increase in requests.

Resource: Thanks Hackernoon

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay