Skip to content
Marak edited this page Aug 23, 2012 · 1 revision

Engines can be specified when defining a resource with this.use:

var Creature = resource.define('creature', function () {
  
  this.use('couchdb', {
    uri: 'http://example.jesusabdullah.net'
  });

  /*
  
      //
      // alternately
      //
      this.use('memory');

      //
      // or, supposing `Engine` is defined as a resourceful engine:
      //
      this.use(Engine, {
        'uri': 'file:///tmp/datastore'
      });

  */

});

Using the CouchDB engine

First, one must create a CouchDB database for resourceful to use. One way to do this is to use Futon, located by default at http://localhost:5984/_utils/. In this example, we name the database myResourcefulDB.

Next, let resourceful know to use use this particular CouchDB database.

var resourceful = require('resourceful');

resourceful.use('couchdb', {database: 'myResourcefulDB'});
Clone this wiki locally