Update to node 0.8 : "sys" is now called "util".
authorDjebbZ <khalid.jebbari@gmail.com>
Tue, 14 Aug 2012 13:16:30 +0000 (16:16 +0300)
committerIgor Minar <igor@angularjs.org>
Thu, 18 Oct 2012 06:19:14 +0000 (23:19 -0700)
Simple text and replace and it works on node 0.8.

scripts/web-server.js

index d560e4a..af830da 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env node
 
-var sys = require('sys'),
+var util = require('util'),
     http = require('http'),
     fs = require('fs'),
     url = require('url'),
@@ -41,7 +41,7 @@ function HttpServer(handlers) {
 HttpServer.prototype.start = function(port) {
   this.port = port;
   this.server.listen(port);
-  sys.puts('Http Server running at http://localhost:' + port + '/');
+  util.puts('Http Server running at http://localhost:' + port + '/');
 };
 
 HttpServer.prototype.parseUrl_ = function(urlString) {
@@ -55,7 +55,7 @@ HttpServer.prototype.handleRequest_ = function(req, res) {
   if (req.headers['user-agent']) {
     logEntry += ' ' + req.headers['user-agent'];
   }
-  sys.puts(logEntry);
+  util.puts(logEntry);
   req.url = this.parseUrl_(req.url);
   var handler = this.handlers[req.method];
   if (!handler) {
@@ -108,9 +108,9 @@ StaticServlet.prototype.sendError_ = function(req, res, error) {
   res.write('<!doctype html>\n');
   res.write('<title>Internal Server Error</title>\n');
   res.write('<h1>Internal Server Error</h1>');
-  res.write('<pre>' + escapeHtml(sys.inspect(error)) + '</pre>');
-  sys.puts('500 Internal Server Error');
-  sys.puts(sys.inspect(error));
+  res.write('<pre>' + escapeHtml(util.inspect(error)) + '</pre>');
+  util.puts('500 Internal Server Error');
+  util.puts(util.inspect(error));
 };
 
 StaticServlet.prototype.sendMissing_ = function(req, res, path) {
@@ -127,7 +127,7 @@ StaticServlet.prototype.sendMissing_ = function(req, res, path) {
     ' was not found on this server.</p>'
   );
   res.end();
-  sys.puts('404 Not Found: ' + path);
+  util.puts('404 Not Found: ' + path);
 };
 
 StaticServlet.prototype.sendForbidden_ = function(req, res, path) {
@@ -143,7 +143,7 @@ StaticServlet.prototype.sendForbidden_ = function(req, res, path) {
     escapeHtml(path) + ' on this server.</p>'
   );
   res.end();
-  sys.puts('403 Forbidden: ' + path);
+  util.puts('403 Forbidden: ' + path);
 };
 
 StaticServlet.prototype.sendRedirect_ = function(req, res, redirectUrl) {
@@ -160,7 +160,7 @@ StaticServlet.prototype.sendRedirect_ = function(req, res, redirectUrl) {
     '">here</a>.</p>'
   );
   res.end();
-  sys.puts('301 Moved Permanently: ' + redirectUrl);
+  util.puts('301 Moved Permanently: ' + redirectUrl);
 };
 
 StaticServlet.prototype.sendFile_ = function(req, res, path) {