fix(backend): add auth middleware to walkthrough routes
This commit is contained in:
parent
046bb9361e
commit
73958c5a5f
1 changed files with 9 additions and 0 deletions
|
|
@ -10,6 +10,15 @@ import {
|
||||||
} from '../controllers/walkthrough.controller';
|
} from '../controllers/walkthrough.controller';
|
||||||
|
|
||||||
export async function walkthroughRoutes(server: FastifyInstance) {
|
export async function walkthroughRoutes(server: FastifyInstance) {
|
||||||
|
// Auth middleware
|
||||||
|
server.addHook('onRequest', async (request) => {
|
||||||
|
try {
|
||||||
|
await request.jwtVerify();
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Walkthrough CRUD
|
// Walkthrough CRUD
|
||||||
server.post('/', createWalkthrough);
|
server.post('/', createWalkthrough);
|
||||||
server.get('/', getWalkthroughs);
|
server.get('/', getWalkthroughs);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue