Skip to content

Commit

Permalink
Replacing sys.puts / error to console.log / error.
Browse files Browse the repository at this point in the history
The "sys" module is now called "util" and it is not really necessary in this example.
  • Loading branch information
Pablo Cantero committed Jun 28, 2012
1 parent b184ea4 commit af917a9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/file-server.js
@@ -1,4 +1,3 @@
var sys = require('sys');
var static = require('../lib/node-static'); var static = require('../lib/node-static');


// //
Expand All @@ -13,14 +12,14 @@ require('http').createServer(function (request, response) {
// //
file.serve(request, response, function (err, res) { file.serve(request, response, function (err, res) {
if (err) { // An error as occured if (err) { // An error as occured
sys.error("> Error serving " + request.url + " - " + err.message); console.error("> Error serving " + request.url + " - " + err.message);
response.writeHead(err.status, err.headers); response.writeHead(err.status, err.headers);
response.end(); response.end();
} else { // The file was served successfully } else { // The file was served successfully
sys.puts("> " + request.url + " - " + res.message); console.log("> " + request.url + " - " + res.message);
} }
}); });
}); });
}).listen(8080); }).listen(8080);


sys.puts("> node-static is listening on http://127.0.0.1:8080"); console.log("> node-static is listening on http://127.0.0.1:8080");

0 comments on commit af917a9

Please sign in to comment.