Retain webservice storage plugin
npm install retain-http!retain-http
===========
Retain REST webservice plugin
 
To start saving the __Retain__ data in a REST webservice, simply inject the plugin into the Model.
`` javascript
var retain = require("retain");
var retainAjax = require("retain-http");
var Movies = retain();
Movies.use(retainAjax, {
rest: "http://localhost:3000/movies"
})
`
npm install retain-http
If you want you use __retain-http__ in the browser, there are 2 options:
* If your bundler have implemented the package.son browser spec, just require the file using the require signature:`
javascript
require("retain-http");
`lib/client.js
* Browserify support this spec
* Otherwise, require the file using the CJS signature
> You can map the retain-http name to the lib/client.js file using your bundler mapping option, so you can require it using the default signature require('retain-http')
* __rest__: REST URL that will be used to save the data.
* __search__: URL that will be used to search the data (sending the attributes filter as parameter).
Retain use Promises internally to transfer data between the plugins.
To create a plugin, it is necessary to implement each of the following __Retain__ methods.
* __new__
* __all__
* __set__
* __find__
* __remove__
Each of theses methods must return a promise.
To run the tests in the server:
make test
To run the tests in the browser:
> Initialize the server where the data will be requested:
make server
> Initialize the server to see the tests outputs
make test-browser
Visit localhost:4000/` in the browser.