Skip to content

n-bhasin/RoleBased-Auth-Nodejs-MongoDB

Repository files navigation

RoleBased-Auth-Nodejs-MongoDB

Introduction

This is a backend template for Role based authentication which is created by using nodejs, epxress, jwt and mongoDB. It is perfect fit for creating a Customer management system using nodejs-backend or reactjs-frontend.

Created By


Name: Bhasin Neeraj
Email: [email protected]

Project File Structure

File Details(contains)
congif.json mongoDB Url, JWT private key
helpers/db.js contains the monogoDB connection
helpers/errorHandler.js global errors
helpers/jwt.js authenticates the token and role.
helpers/role.js contains the roles(Admin, User)
services/user.services.js all methods that perform crud operation
routes/user.controllers.js routes to all crud operations

Project Images Using Postman

Register new User

alt text

Authenticate user

[Authenticate user

Current user

[Current user

Unauthorized Access

[Unauthorized Access

Instructions

1. clone the repo
2. install npm packages-> npm install
3. run the app.js-> node app.js
4. use the postman to test the app

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published