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

Method use

integration/hello-world/e2e/middleware-fastify.spec.ts:30–40  ·  view source on GitHub ↗
(
        req: FastifyRequest['raw'] & { headers: Record<string, unknown> },
        res,
        next: () => void,
      )

Source from the content-addressed store, hash-verified

28 @Injectable()
29 class AuthMiddleware implements NestMiddleware {
30 use(
31 req: FastifyRequest['raw'] & { headers: Record<string, unknown> },
32 res,
33 next: () => void,
34 ) {
35 if (req.headers['x-auth'] === '1') {
36 return next();
37 }
38 res.statusCode = 401;
39 res.end('unauthorized');
40 }
41 }
42
43 @Controller('users')

Callers

nothing calls this directly

Calls 2

endMethod · 0.65
nextFunction · 0.50

Tested by

no test coverage detected