Skip to content

jack-sparroow/Express.js-boilerplate-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Express MongoDB Boilerplate

Description

Express.js boilerplate code for writing efficient web server. This boiler plate contains bare minimum code required for webserver with assoiciation of routes and contollers with specific services.

Directory structure

+-- package.json
+-- package-lock.json
+-- .gitignore
+-- src
    +-- index.js
    +-- controllers
        +-- index.js
        +-- user.controller.js
    +-- services
        +-- index.js
        +-- user.service.js
    +-- routes
        +-- index.js
        +-- user.routes.js
    +-- models
        +-- index.js
        +-- user.model.js
+-- _utils
    +-- dbConnect.js
    +-- responseHandler.js

Dependencies

  • Express -> Web server
  • Dotenv -> Configure ENV variable
  • Morgan -> Request logger
  • CORS -> CORS policy configurations
  • Mongoose -> MongoDB ORM

Installation

  1. Clone the Repo
  2. Create .env fiile in root directory and put following variables in it
PORT = 1234
DB_URL = yourdburl
  1. Run command npm install in order to install all the dependencies
  2. Run one of the following script

For Dev Mode

$ npm run dev

For Prod Mode

$ npm start

Made with   ❤️   by   Jack

Contributions are hugely appreciated

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published