app.js
This file
Path
examples/error/app.js
26 lines · 731 bytes · JavaScript
Last changed by
Updated examplesTj Holowaychukbefore adoptionf60bcca
History of this fileTake it
The walk stopped after 200 commits: lines older than b75246e point at it.
Added app.redirect(key, url)Tj Holowaychukbefore adoptionb75246e
lines 1–15why, one step back12/**3 * Module dependencies.4 */56var express = require('./../../lib/express'),7 connect = require('connect');89var app = express.createServer();1011app.get('/', function(req, res){12 // Caught and passed down to the errorHandler middleware13 throw new Error('something broke!');14});15Updated examplesTj Holowaychukbefore adoptionf60bcca
line 16why, one step back16app.get('/next', function(req, res, next){Added app.redirect(key, url)Tj Holowaychukbefore adoptionb75246e
lines 17–26why, one step back17 // We can also pass exceptions to next()18 next(new Error('oh no!'))19});2021// The errorHandler middleware in this case will dump exceptions to stderr22// as well as show the stack trace in responses, currently handles text/plain,23// text/html, and application/json responses to aid in development24app.use('/', connect.errorHandler({ dumpExceptions: true, showStack: true }));2526app.listen(3000);