Created
February 14, 2011 19:41
-
-
Save AdrianRossouw/826409 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.paths.unshift(__dirname + '/modules', __dirname + '/lib/node', __dirname); | |
var connect = require('connect'), | |
express = require('express'), | |
sys = require('sys'); | |
var app = new express.Server(); | |
// expectation : will be run after the more general app.all(). | |
app.get('/foo', function(req, res, next) { | |
console.log('foo'); | |
res.send('foo'); | |
// purposefully not calling next() | |
}); | |
// expectation: will be run before app.get(). | |
app.all('/foo', function(req, res, next) { | |
// allow us to populate things in the req/res for all pages that match the route. | |
console.log('here'); | |
next(); | |
}); | |
app.listen(8888); | |
// results : with app.all first in code, expected results occur. | |
// with app.get first in code, only app.get is run. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment