GithubHelp home page GithubHelp logo

boilerplate-node-express-server's Introduction

Node Express Server Boilerplate

This is a node server with express for performing CRUD operations. Mongoose is being used as the database.

Features Implemented

Some basic features have already been implemented:

  • Basic mongoose model for User
  • User Registrartion and Login
  • Validation and sanatization using express-validator
  • Error Handling middleware
  • Pre-enabled cors
  • Authorization middleware for JWT token authentication in middleware/auth.js

Node Version Used

$ node -v
v16.16.0
$ npm -v
v8.15.0

Setup

After cloning the repo run the following command to install all the dependencies:

$ npm install

Note: Make sure that mongoDB is installed and running if you are going to use local database.

By default, the app will start on port 5000 using the local environment. For overriding the default environment, run the below commands using the <environment> from local/dev/live.

$ set NODE_ENV=<environment>

For overriding the default port just provide a port number as an environment variable before running npm start

$ set PORT=<port_number>

After the dependencies have been installed successfully and the environment variables have been set, run the following command to start the application:

$ node index.js

Changing Environment Variables

Make your way to src/EnvConfigs/<environment>.js and change the environment variables according to your needs.

Database

You can easily change the MongoDB URI by changing the value of the database key for the local variable in the src/EnvConfigs/<environment>.js file for your environment.

boilerplate-node-express-server's People

Contributors

hammadmaqsood24 avatar

Watchers

 avatar

Forkers

mohammadmazin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.