Skip to content

Instantly share code, notes, and snippets.

@laser
Created April 30, 2014 21:21
Show Gist options
  • Save laser/5fa6ee11130dd3157e8f to your computer and use it in GitHub Desktop.
Save laser/5fa6ee11130dd3157e8f to your computer and use it in GitHub Desktop.
Barrister RPC Client w/Authentication Header
// Barrister Client Initialization
function initApp(callback) {
var client = Barrister.httpClient({
'endpoint': '/todos',
'interfaces': ['TodoManager']
});
client.loadContract(function() {
var proxy = client.proxy('TodoManager');
callback(null, proxy);
});
}
// API Client Usage (Barrister)
initApp(function(err, TodoManager) {
TodoManager.readTodos(function(err, todos) {
$('#todos').text(JSON.stringify(todos));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment