Http-errors
const createError = require('http-errors')
app.use(function (req, res, next) {
if (!req.user) return next(createError(401, 'Please login to view this page.'))
next()
})Possible Constructors
const err = new createError.NotFound("Error message here");//constructors for all HTTP errorsList of all constructors
Last updated