Skip to content

pejmanhadavi/real-world-example-nestjs-mongoose-jwt-auth

Repository files navigation

Awesome

real-world-example-nestjs-mongoose-jwt-auth-roles-and-permission


Getting started

Installation

Clone the repository

git clone https://github.com/pejmanhadavi/real-world-example-nestjs-mongoose-jwt-auth.git

Switch to the repo folder

cd real-world-example-nestjs-mongoose-jwt-auth

Install dependencies

npm install

Create a .env file and write it as follows

MONGO_URI='mongodb://localhost/YOURMONGODBNAME'
JWT_SECRET='YOURJWTSECRETCHANGEIT'
ENCRYPT_JWT_SECRET='YOURJWTENCRIPTINGPASSCHANGEIT'
JWT_EXPIRATION=30m

Database

The example codebase uses Mongoose.


NPM scripts

  • npm run start:watch - Start application in watch mode

Authentication

This applications uses JSON Web Token (JWT) to handle authentication. This app uses refresh-Token mechanism to refresh jsonwebtoken after 30 minutes.


Swagger API docs

Visit http://127.0.0.1:3000/api in your browser

This example repo uses the NestJS swagger module for API documentation. NestJS Swagger - www.swagger.io

Authors

Pejman Hadavi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published