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
The example codebase uses Mongoose.
npm run start:watch
- Start application in watch mode
This applications uses JSON Web Token (JWT) to handle authentication. This app uses refresh-Token mechanism to refresh jsonwebtoken after 30 minutes.
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
Pejman Hadavi