Skip to content

This will create a REST API using Express JS and MongoDB removing the hassle of creating everything from scratch.

Notifications You must be signed in to change notification settings

souvikdasdev/rest-api-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fastest way to create REST API with Node.js, Express.js & MongoDB.

Prerequisites

  • Node.js needs to be installed.
  • MongoDB Compass needs to be installed only if you are running this api as it is. If you are using the MongoDB cloud database then just change the DATABASE_URI in index.js.

Installation

  • Run npx rest-api-init.
  • When prompted to install rest-api-init package, enter y
  • On completion, open terminal inside the root directory and run npm start
  • Open localhost:5000 on your browser to view the text Your server is ready!

Features

Configuration

  • index.js initializes the REST API
    • PORT defines the port in which the server will run. The URL will look like this
      localhost:<PORT>
    • DATABASE_URI is configured for local database by default which needs MongoDB Compass to be installed.
  • routes/routes.js will contain the routes e.g. get/post/patch/put/delete
  • models/model.js will have the Schema defined for the database

Preferably define PORT and DATABASE_URI in a .env file.

About

This will create a REST API using Express JS and MongoDB removing the hassle of creating everything from scratch.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published