Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update code to node v0.1.30 async api.

  • Loading branch information...
commit 02fcba3a368f06c88c3d9deb318533eab44fc910 1 parent a0c241e
@creationix authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 node-router.js
View
8 node-router.js
@@ -195,7 +195,11 @@ exports.staticHandler = function (req, res, filename) {
return;
}
- fs.readFile(filename, encoding).addCallback(function (data) {
+ fs.readFile(filename, encoding, function (err, data) {
+ if (err) {
+ notFound(req, res, "Cannot find file: " + filename);
+ return;
+ }
body = data;
headers = [ [ "Content-Type" , content_type ],
[ "Content-Length" , body.length ]
@@ -203,8 +207,6 @@ exports.staticHandler = function (req, res, filename) {
headers.push(["Cache-Control", "public"]);
callback();
- }).addErrback(function () {
- notFound(req, res, "Cannot find file: " + filename);
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.