Skip to content

Instantly share code, notes, and snippets.

@EvanHahn
Created April 10, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanHahn/e9dedbc01cadacc7295542bf47f7faed to your computer and use it in GitHub Desktop.
Save EvanHahn/e9dedbc01cadacc7295542bf47f7faed to your computer and use it in GitHub Desktop.
const connect = require('./')
const app = connect()
app.use((req, res, next) => {
console.log('In middleware 1')
next()
})
app.use((req, res, next) => {
console.log('In middleware 2')
next(404)
})
app.use((err, req, res, next) => {
console.log('In error middleware. Error is a(n)', typeof err)
res.end('Error!')
})
app.listen(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment