feat(backend): initial setup for cms backend service
This commit is contained in:
12
backend/src/middleware/auth.middleware.ts
Normal file
12
backend/src/middleware/auth.middleware.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { FastifyRequest, FastifyReply } from 'fastify';
|
||||
|
||||
export async function authenticate(
|
||||
request: FastifyRequest,
|
||||
reply: FastifyReply
|
||||
) {
|
||||
try {
|
||||
await request.jwtVerify();
|
||||
} catch (err) {
|
||||
reply.code(401).send({ error: 'Unauthorized' });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user