Added some pages
This commit is contained in:
@@ -41,3 +41,16 @@ export const loggingMiddleware = (req, res, next) => {
|
||||
|
||||
console.log(`${toLocalISO(new Date())} | ${req.method} ${req.originalUrl} ${coloredStatusCode}`)
|
||||
}
|
||||
|
||||
export const authMiddleware = getUserForSession => async (req, res, next) => {
|
||||
if (req.cookies.sid) {
|
||||
req.user = await getUserForSession(req.cookies.sid)
|
||||
console.log('Request from user: ' + req.user)
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
export const authenticatedMiddleware = (req, res, next) => {
|
||||
req.user && next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user