Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laser/2caea63840dc135a0878 to your computer and use it in GitHub Desktop.
Save laser/2caea63840dc135a0878 to your computer and use it in GitHub Desktop.
Basic Client - Node.js
#!/usr/bin/env node
var barrister = require('barrister');
var client = barrister.httpClient('http://localhost:3000/v1/todos');
client.loadContract(function(err) {
var proxy = client.proxy('TodoManager');
var properties = { 'title' : 'Call Dad', 'completed' : false };
proxy.createTodo(properties, function(err, result) {
if (err) {
console.log(JSON.stringify(err));
}
else {
console.log(JSON.stringify(result));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment