How can I access route params in Nestjs middleware

Viewed 340

I'm creating a middleware in nestjs and here is how the structure looks like

export class TestModule implements NestModule {
    configure(consumer: MiddlewareConsumer) {
        consumer
            .apply(TestMiddleware)
            .forRoutes('/test/:id')
    }
}

I'm using fastify Adaptor and I've a question that how can I access the route param in my middleware. I've tried accessing req.params but it comes empty and can't see any other property having the route param in it.

0 Answers
Related