MCPcopy
hub / github.com/nestjs/nest / configure

Method configure

integration/hello-world/e2e/middleware-fastify.spec.ts:613–626  ·  view source on GitHub ↗
(consumer: MiddlewareConsumer)

Source from the content-addressed store, hash-verified

611 })
612 class DataModule implements NestModule {
613 configure(consumer: MiddlewareConsumer) {
614 consumer
615 .apply((req, res, next) => {
616 req.extras = { data: 'Data attached in middleware' };
617 req.headers['ping'] = 'pong';
618
619 // When global prefix is set and the route is the root path
620 if (req.originalUrl === '/api') {
621 return res.end(JSON.stringify({ success: true, pong: 'pong' }));
622 }
623 next();
624 })
625 .forRoutes('{*path}');
626 }
627 }
628
629 beforeEach(async () => {

Callers

nothing calls this directly

Calls 4

forRoutesMethod · 0.65
applyMethod · 0.65
endMethod · 0.65
nextFunction · 0.50

Tested by

no test coverage detected