Skip to content

Commit

Permalink
Update for node 1.16 api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Nov 5, 2009
1 parent 53b8787 commit 073f463
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hello_world.js
Original file line number Diff line number Diff line change
@@ -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") + "!");
Expand Down
6 changes: 3 additions & 3 deletions http_server.js
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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 ]
Expand Down
4 changes: 2 additions & 2 deletions memresourced.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var server = require('http_server.js');
var server = require('./http_server')

var people = [
{ name: "Bob", age: 47, programmer: false },
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions todos_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 073f463

Please sign in to comment.