Install NestJS(which is node application) CLI into the local machine
$ npm i -g @nestjs/cli
In project root folder install all packages
$ npm install
Run application
$ npm run start:dev
http://localhost:3000/auth/login
# payload
{
"username": "test",
"password":"1234"
}
# API response
{
"access_token":"",
"refresh_token":""
}
For testing purpose to expire the Jwt token we can set the expiration at
# src/auth/aut.module.ts
`JwtModule.register({
secret: 'secret',
signOptions: { expiresIn: '1800s' },
})`
you can change value at 'expiresIn', default set {1800 seconds}--> 30mins
http://localhost:3000/auth/refreshtoken
# payload
{
"access_token":"",
"refresh_token":""
}
#API Resonse
{
"access_token":"",
"refresh_token":""
}
#API to consume with a valid token as its header
http://localhost:3000/user/fav-movies
#API Response
[
{
id:'',
name:'',
genre:''
}
]
- Author - Naveen Bommidi
- Website - Blog
- Youtube - Naveen Bommidi Tech Seeker