Created
May 22, 2013 16:51
-
-
Save caridy/5629094 to your computer and use it in GitHub Desktop.
overruling the method before calling express router
This file contains hidden or 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
var express = require('express'), | |
app = express(); | |
app.use(function (req, res, next) { | |
console.log(req); | |
req.method = 'GET'; | |
next(); | |
}); | |
app.get('/', function (req, res, next) { | |
res.send({foo: 1}); | |
}); | |
// listening | |
app.set('port', 3000); | |
app.listen(app.get('port'), function () { | |
console.log("Server listening on port " + | |
app.get('port') + " in " + app.get('env') + " mode"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment