Created
June 19, 2013 03:14
-
-
Save Hoverbear/5811440 to your computer and use it in GitHub Desktop.
Express.js app.use() middleware example.
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
### | |
Browse to http://localhost:8080 to see the following output: | |
# Hello | |
### | |
# Ignore | |
app = require('express')() | |
# Important stuff! | |
app.use (req, res)-> | |
console.log "Hello" | |
app.use (req, res)-> | |
console.log "World" | |
# Ignore | |
app.listen 8080 |
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
### | |
Browse to http://localhost:8080 to see the following output: | |
# Hello World | |
### | |
# Ignore | |
app = require('express')() | |
# Important stuff! | |
app.use (req, res, next)-> | |
console.log "Hello" | |
next() | |
app.use (req, res, next)-> | |
console.log "World" | |
next() | |
# Ignore | |
app.listen 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment