'How can I access route params in Nestjs middleware

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source