-
Notifications
You must be signed in to change notification settings - Fork 3
API Reference
As of the current version of Titanium Mobile (1.6.2), all AJAX requests are asynchronous, so the couchdb_client module makes extensive use of callbacks.
If you're new to CouchDB in general, your two main resources for learning about this awesome database are the [CouchDB wiki] and [CouchDB: The Definitive Guide].
Almost every function in the module has an "options" parameter. The options object is used by the caller to provide success and failure callbacks, authentication information, and extra parameters. Here's an example options object with the most common properties shown:
{
username: "someuser",
password: "opensesame",
success: function(data) {
// data contains the response from CouchDB as an object
},
failure: function(xhr) {
// xhr contains the XMLHttpRequest used to make the call to CouchDB
}
}
Load the module into your application using the require() function:
var couchdb = require('com.obscure.couchdb_client');
couchdb.urlPrefix = 'http://localhost:5984';
The urlPrefix member must be provided before using the module, so it is best to set it immediately after loading as shown.