The errorhandler
middleware should only be enabled in development mode.
Enabling this in production can reveal sensitive information about your application to a client.
This includes file paths, error messages, directory structure, and debug instructions.
import express from 'express'
import errorhandler from 'errorhandler'
const app = express()
// This will enable the error handler in both
// and production
app.use(errorhandler())
import express from 'express'
import errorhandler from 'errorhandler'
const app = express()
if (process.env.NODE_ENV === 'development') {
app.use(errorhandler())
}