Skip to content

Commit

Permalink
Update code to node v0.1.30 async api.
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Feb 26, 2010
1 parent a0c241e commit 02fcba3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions node-router.js
Expand Up @@ -195,16 +195,18 @@ exports.staticHandler = function (req, res, filename) {
return; 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; body = data;
headers = [ [ "Content-Type" , content_type ], headers = [ [ "Content-Type" , content_type ],
[ "Content-Length" , body.length ] [ "Content-Length" , body.length ]
]; ];
headers.push(["Cache-Control", "public"]); headers.push(["Cache-Control", "public"]);


callback(); callback();
}).addErrback(function () {
notFound(req, res, "Cannot find file: " + filename);
}); });
} }


Expand Down

0 comments on commit 02fcba3

Please sign in to comment.