Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated to work with new File object in master.

  • Loading branch information...
commit 51eb3134c1df904aef5ce35694e29fce7204a622 1 parent 83e5929
brandon authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 todos_backend.js
View
8 todos_backend.js
@@ -4,6 +4,8 @@
// 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');
+
var server = require('http_server.js');
var tasks;
@@ -39,9 +41,9 @@ function apply_json_to_task(task, json_hash) {
// Serialize the data to the disk
function save_data() {
- var fd = node.fs.open("tasks.db", node.O_WRONLY, 0666).wait();
- node.fs.write(fd, JSON.stringify(tasks)).wait();
- node.fs.close(fd).wait();
+ var file = new File("tasks.db", "w");
+ file.write(JSON.stringify(tasks));
+ file.close();
}
// Load the data from the disk
Please sign in to comment.
Something went wrong with that request. Please try again.