Skip to content

Commit

Permalink
Update src/util/middlewares.js
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
lelemm and coderabbitai[bot] authored Nov 11, 2024
1 parent b9cc5a5 commit f6273a6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/util/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,26 @@ async function errorMiddleware(err, req, res, next) {
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
/**
* Middleware to validate session and attach it to response locals
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
const validateSessionMiddleware = async (req, res, next) => {
let session = await validateSession(req, res);
if (!session) {
res.status(401).json({
status: 'error',
reason: 'invalid-session'
});
return;
}

res.locals = session;
res.locals.session = session;
next();
};
};

Check failure on line 53 in src/util/middlewares.js

View workflow job for this annotation

GitHub Actions / build

Declaration or statement expected.

const requestLoggerMiddleware = expressWinston.logger({
transports: [new winston.transports.Console()],
Expand Down

0 comments on commit f6273a6

Please sign in to comment.