Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 2.01 KB

File metadata and controls

42 lines (31 loc) · 2.01 KB

Nodejs Simple Authentication System

Prerequisites

Base dependencies

  • express minimalist web framework for node.
  • bcryptjs for password-hashing.
  • body-parser as body parsing middleware.
  • helmet Helmet helps you secure your Express apps by setting various HTTP headers. It's not a silver bullet, but it can help!
  • jsonwebtoken An implementation of JSON Web Tokens.
  • mongoose MongoDB object modeling designed to work in an asynchronous environment.

How to Install (CLI)

  1. Make sure that you have Node.js and npm installed.
  2. Clone this repo using git clone https://github.com/taheroo/node-authentication
  3. Move to the appropriate directory: cd node-authentication.
  4. Create a .env file inside config folder following the example inside .env.example
  5. Run npm install in order to install dependencies.
  6. Run npm start to start app.
  7. You can check authentication endpoints using Postman by importing this collection https://www.getpostman.com/collections/2fd07df74b3ef749e207

Project structure

This template follows a very simple project structure:

  • src: This folder is the main container of all the code inside your application.
    • api: This folder contains main api configurations.
    • config: Folder to set project configurations.
    • middleware: Folder that contains all middlewares.
    • models: Folder that contains all the mongoose models.
    • scripts: Folder that contains all scripts.
    • app.js: Entry point of the application.

Further Reading