Skip to content

About

RESTful API adapter for Sails / Waterline

Resources

Contributing

Stars

1 star

Watchers

3 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

image_squidhome@2x.png

sails-restful

Provides easy access to RESTful APIs, inline with the SOON API spec, from Sails.js & Waterline.

This module is a Waterline/Sails adapter, an early implementation of a rapidly-developing, tool-agnostic data standard. Its goal is to provide a set of declarative interfaces, conventions, and best-practices for integrating with all sorts of data sources. Not just databases-- external APIs, proprietary web services, or even hardware.

Strict adherence to an adapter specification enables the (re)use of built-in generic test suites, standardized documentation, reasonable expectations around the API for your users, and overall, a more pleasant development experience for everyone.

Installation

To install this adapter, run:

$ npm install sails-restful

Usage

// api/models/Queue.js
module.exports = {
  adapter: 'restful',
  url: '/player/queue'
};

// config/connections.js, add:
restful: {
  module: 'sails-restful',
  host: 'api.thisissoon.fm',
  port: 443,
  protocol: 'https',
  headers: {}
}

Interfaces

This adapter implements the semantic interface and exposes the following methods:

find()

GET one or more records.

create()

POST a new record.

update()

PUT to a record.

destroy()

DELETE a record.

Support for the subscribable interface is planned.

For more information, check out this repository's FAQ and the adapter interface reference in the Sails docs.

Development

Check out Connections in the Sails docs, or see the config/connections.js file in a new Sails project for information on setting up adapters.

Running the tests

Configure the interfaces you plan to support (and targeted version of Sails/Waterline) in the adapter's package.json file:

In your adapter's directory, run:

$ npm test

Questions?

See FAQ.md.

More Resources

License

MIT © 2015 SOON_

Sails is free and open-source under the MIT License.

About

RESTful API adapter for Sails / Waterline

Resources

Contributing

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages