Skip to content

Json server powered by express.js that works on aws lambda

License

Notifications You must be signed in to change notification settings

itsbhatt/json-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-server

Json server powered by express.js that works on AWS Lambda

This project provides a json mock server which can be deployed on AWS Labda leveraging serverless-http core functionalities.

How to install

There is no installation so to say, you just have to clone this repo and you are good to go.

git clone https://github.com/ItsBhatt/json-server.git

Overview

json-server takes advantage of serverless-http package which acts as a wrapper and exported as a handler supported by AWS Lambda. It can be deployed on serverless functions as well as on normal servers.

Structure

  • helpers -> Parsing the req + generating response
  • db.json -> Mock data which will be used for response generation
  • index.js -> Root File
  • routes.js -> express server routes

Usage

After clonning the repo you can simply add you mock json data inside db.json on the root directory.

Deployment

It can be deployed on any platform(server/serverless) and it works seamlessly.

AWS-Lambda

Asuming you have already created api and lambda function

Step 1 - Just create a .zip of all files including node_modules.
Step 2 - Open your labda function and upload the .zip file.
Step 3 - Add a environment variable ENVIRONMENT=production.
Step 4 - Deploy the function 🎊 .

Other

You can simply deploy this as an express app on any server.

Releases

No releases published

Packages

No packages published