Last active
August 29, 2015 14:01
-
-
Save laser/2caea63840dc135a0878 to your computer and use it in GitHub Desktop.
Basic Client - Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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