Skip to content

Commit

Permalink
docs: use finalhandler in example
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Aug 24, 2014
1 parent 536ed9b commit ddf5e67
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Expand Up @@ -61,16 +61,15 @@ This middleware can be used anywhere, even outside express/connect. It takes `re
```javascript
var http = require('http');
var favicon = require('serve-favicon');
var finalhandler = require('finalhandler');

var _favicon = favicon(__dirname + '/public/favicon.ico');

var server = http.createServer(function onRequest(req, res) {
var done = finalhandler(req, res);

_favicon(req, res, function onNext(err) {
if (err) {
res.statusCode = 500;
res.end();
return;
}
if (err) return done(err);

// continue to process the request here, etc.

Expand Down

0 comments on commit ddf5e67

Please sign in to comment.