-
-
Save pomeo/8258736 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
/** | |
* @overview | |
* | |
* @author Caesar Chi | |
* @blog clonn.blogspot.com | |
* @version 2012/02/27 | |
*/ | |
var express = require('express'), | |
app = express.createServer(), | |
port = 1337; | |
function middleHandler(req, res, next) { | |
console.log("execute middle ware"); | |
next(); | |
} | |
app.use(function (req, res, next) { | |
console.log("first middle ware"); | |
next(); | |
}); | |
app.use(function (req, res, next) { | |
console.log("second middle ware"); | |
next(); | |
}); | |
app.get('/', middleHandler, function (req, res) { | |
console.log("end middleware function"); | |
res.send("page render finished"); | |
}); | |
app.listen(port); | |
console.log('start server'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment