Sourcery
Sourcery is a framework for building RESTful API clients. It's heavily inspired by ActiveResource and behaves almost the same way. It's blazing fast and extremely simple to use.
Synopsis
Defining resources
var Resource = ; var Base = Resource; var Project = Base;
CRUD
Find one:
Project;
Find many:
Projectall user_id: 1 { projects0; projects1;};
Create:
var project = ;project; project;
Project;
Update:
var project = id: 1 ;project; project;
Destroy:
Project;
var project = id: 1 ; project;
Include params:
Project all { console; };
Nested resources
var Task = Base;
Sourcery will replace the placeholders, in this example ":project_id", with the matching attribute.
Basic Auth
var BasicAuth = BasicAuth; var Base = Resource;
Wait, but what about...
Please open issues if you have feature requests. Thanks!
Install
$ npm install sourcery
Requirements
- Node.js >= 0.6.0
Tests
$ npm install
$ make test
Real world examples
TODO
- More examples
- Fake Engine
- Custom endpoints
- Schema
- Associations
- Validations
- Test helpers
- XML
- Custom error classes
- Resource.member()
License
MIT License
Copyright (C) 2012 Veselin Todorov (hi@vesln.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.