Browse files

Update for node 1.16 api changes

  • Loading branch information...
1 parent 53b8787 commit 073f463a81ee75b059bfbbd1d9ed3aa7f6bfc340 @creationix committed Nov 5, 2009
Showing with 9 additions and 9 deletions.
  1. +1 −1 hello_world.js
  2. +3 −3 http_server.js
  3. +2 −2 memresourced.js
  4. +3 −3 todos_backend.js
View
2 hello_world.js
@@ -1,4 +1,4 @@
-var server = require('http_server.js');
+var server = require('./http_server')
function hello(req, res, match) {
res.simpleHtml(200, "Hello " + (match || "World") + "!");
View
6 http_server.js
@@ -1,5 +1,5 @@
-node.mixin(require('/utils.js'));
-var http = require('/http.js');
+process.mixin(require('sys'));
+var http = require('http')
var NOT_FOUND = "Not Found\n";
@@ -194,7 +194,7 @@ exports.staticHandler = function (req, res, filename) {
return;
}
- node.fs.cat(filename, encoding).addCallback(function (data) {
+ process.fs.cat(filename, encoding).addCallback(function (data) {
body = data;
headers = [ [ "Content-Type" , content_type ],
[ "Content-Length" , body.length ]
View
4 memresourced.js
@@ -1,4 +1,4 @@
-var server = require('http_server.js');
+var server = require('./http_server')
var people = [
{ name: "Bob", age: 47, programmer: false },
@@ -7,7 +7,7 @@ var people = [
];
function on_change(id) {
- node.debug(id, JSON.stringify(people[id]));
+ process.debug(id, JSON.stringify(people[id]));
}
server.resource("people", server.resourceController("people", people), on_change);
View
6 todos_backend.js
@@ -4,9 +4,9 @@
// This provides the same REST style api as the merb example and even hosts
// on port 4000. It's a drop in replacement for the sample merb backend.
-include('/file.js');
+include('/file');
-var server = require('http_server.js');
+var server = require('./http_server')
var tasks;
@@ -49,7 +49,7 @@ function save_data() {
// Load the data from the disk
function load_data(callback) {
// Load the database from disk
- var promise = node.fs.cat("tasks.db", "utf8");
+ var promise = process.fs.cat("tasks.db", "utf8");
promise.addCallback(function (json) {
tasks = JSON.parse(json);
callback(true);

0 comments on commit 073f463

Please sign in to comment.