Old partial attempt at "public mode"

This commit is contained in:
Wingy 2020-10-29 11:24:13 -04:00
parent f872785e64
commit 8f6b030ca8
6 changed files with 37 additions and 18 deletions

11
middlewares/public.js Normal file
View file

@ -0,0 +1,11 @@
const verifyAuth = require('./verifyAuth')
const middlewareNoop = ( (_1, _2, next) => next() )
const publicMiddleware = () => process.env.LISTS_PUBLIC === 'true' ?
(req, res, next) => {
if (!req.user) req.user = { _id: 'Unknown' }
next()
}
: verifyAuth()
module.exports = publicMiddleware