christmas/middlewares/public.js
2020-10-29 11:24:13 -04:00

11 lines
No EOL
304 B
JavaScript

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