module.exports = async (req, res) => { if(!req.user) { const err = new Error('Unauthorized') err.status = 401 throw err; } return 'next' }