diff --git a/server/src/api/routes/index.js b/server/src/api/routes/index.js index 2f66036..5a52f4b 100644 --- a/server/src/api/routes/index.js +++ b/server/src/api/routes/index.js @@ -9,6 +9,7 @@ import userRouter from './userRouter.js' import config from '../../config.js' import leaderboardController from '../controllers/leaderboardController.js' import csrfProtection from '../../middleware/csrfProtection.js' + const router = Router() if (!config.isProduction) { diff --git a/server/src/middleware/csrfProtection.js b/server/src/middleware/csrfProtection.js index 566dde6..94b77c6 100644 --- a/server/src/middleware/csrfProtection.js +++ b/server/src/middleware/csrfProtection.js @@ -1,4 +1,5 @@ import csrf from 'csurf' + const CSRF = csrf({ cookie: true }) function csrfProtection(req, res, next) { if (req.method === 'POST') {