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

Class DataModule

integration/hello-world/e2e/middleware-fastify.spec.ts:609–627  ·  integration/hello-world/e2e/middleware-fastify.spec.ts::DataModule

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

ModuleFunction · 0.90

Tested by

no test coverage detected