chore(api): clean up index file
This commit is contained in:
16
apps/api/src/hooks/request-id.hook.ts
Normal file
16
apps/api/src/hooks/request-id.hook.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type {
|
||||
FastifyReply,
|
||||
FastifyRequest,
|
||||
HookHandlerDoneFunction,
|
||||
} from 'fastify';
|
||||
|
||||
export function requestIdHook(
|
||||
request: FastifyRequest,
|
||||
reply: FastifyReply,
|
||||
done: HookHandlerDoneFunction,
|
||||
) {
|
||||
if (!request.headers['request-id']) {
|
||||
request.headers['request-id'] = request.id;
|
||||
}
|
||||
done();
|
||||
}
|
||||
Reference in New Issue
Block a user