Home

Awesome

<img src="https://github.com/flatiron/resourceful/raw/master/resourceful.png" />

Synopsis

Status

Build Status

Features

Installation

$ [sudo] npm install resourceful

Usage

Simple case

var resourceful = require('resourceful');

var Creature = resourceful.define('creature', function () {
  //
  // Specify a storage engine
  //
  this.use('couchdb');

  //
  // Specify some properties with validation
  //
  this.string('diet');
  this.bool('vertebrate');
  this.array('belly');

  //
  // Specify timestamp properties
  //
  this.timestamps();
});

//
// Now that the `Creature` prototype is defined
// we can add custom logic to be available on all instances
//
Creature.prototype.feed = function (food) {
  this.belly.push(food);
};

<a name="engines"></a>

Engines

Documentation

See the wiki for more documention.

API

Resource Constructor Methods

These methods are available on all user-defined resource constructors, as well as on the default resourceful.Resource constructor.

Resource Instance Methods

Relationship Constructor Methods

These methods are available on all user-defined resource constructors which are in a relationship

Relationship Instance Methods

<a name="relationships"></a>

Relational Resources

Resourceful supports a simple Resource.parent API, supports one-one, one-many, and many-many relationships.

Documentation

Tests

All tests are written with vows and should be run with npm:

  $ npm test

License

Copyright 2012 Nodejitsu, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.