Created
June 4, 2012 18:04
-
-
Save ovaillancourt/2869908 to your computer and use it in GitHub Desktop.
middlleware that catches stuffs the router didn't serve.
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
var express = require('express'); | |
//Create the express app; | |
var app = express.createServer(); | |
app.use(app.router); | |
//You place this middleware right after your router so paths that the | |
//router can't match will go through it and finally end here. | |
app.use(function(req, res, next){ | |
//There you can render a view or put a 404 error page, anything you want. | |
return res.send('Hello this is my static page'); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment