Giter Club home page Giter Club logo

node-boilerplate's Introduction

PSPenta Node API Boilerplate

Installation Guide

System Package Dependencies :-

Nodejs: Download version:- >= v10.16.3

Development Setup :-

  1. Clone the repository and install dependencies

    $ git clone https://github.com/PSPenta/node-boilerplate.git
    $ npm install ( If wants to work with existing version of packages )
    $ npm run update:packages ( If wants to work with latest version of packages )
  2. To start with database configuration create .env file from referencing the env.example file. For MongoDB install Mongoose package

    $ npm i -S mongoose

    For SQL DB install Sequelize package

    $ npm i -S sequelize

    Sequelize supports multiple dialects for DBMS One of the following command with respect to database:

    $ npm install --save pg pg-hstore # Postgres
    $ npm install --save mysql2
    $ npm install --save mariadb
    $ npm install --save sqlite3
    $ npm install --save tedious # Microsoft SQL Server
  3. To run tests

    $ npm test
  4. Start the application

    $ npm start

Local Authentication Service Setup

  1. Add environment variables in .env file referencing from env.example file.
  2. In app.js file require passport.js and the src/services/authServices.js and initialize passport.js.
    const passport = require('passport');
    require('./src/services/authServices');
    passport.initialize();
  3. To create a JWT token use createToken() from authServices.js which takes object and add it in token.
  4. To authenticate any routes use passport.authenticate() as middleware on it.
const passport = require('passport');
router.use('/demo', passport.authenticate('jwt', { session : false }), (req, res) => {});
- Please remove this README.md file when working with live project.

node-boilerplate's People

Contributors

pspenta avatar

Watchers

 avatar

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.