Skip to content

Tag: nestjs

Guard not returning authenticated user

I have created a guard And i am using it on of my endpoints The point is it is faling because getRequest is not returning the authenticated user it is returning undefined How can i return the authenticated user from the response ? Answer You should use your JwtAuthGuard at your controller level since nest doe…

How to deal with NestJS @Get() decorator?

This block of code works properly. I’m able to access both functions with the URL http://localhost:3000/vehicle/availableVehicles & http://localhost:3000/vehicle/1 accordingly But when I just swap between the 2 functions like code block below then the function availableVehicles() doesn’t work …

How to rate limit a NestJS API by multiple time intervals?

I am trying to rate limit my API with @NestJs/throttler. I want to set two different limit caps: 100 requests per 1 second 10,000 requests per 24 hours. Setting either one of these rate limits is explained in the docs and is pretty straight forwad. But, setting both limitations is not articulated in the docs.…

Differentiate 2 routes of a controller (NestJS)

EDIT: When I move the @Get(‘/random’) above the 2 other routes, it’s working… Weird I’m doing a NestJS server that just get some routes of the Breaking Bad API and displays the JSON in the routes of the server, I want to create 3 routes : 1 that returns a JSON of all characters o…