NOTE - This is a very early version of this project and is not yet fully featured.
A resource-oriented DSL for configuring koa.
Configuration
To configure resourced you need to tell it which directory to look for resources in:
var resourced = ;var router = ; Q;
Note that koa-router is also required and that it, and any other middleware, must be installed before resourced.
Resource Definition
The following shows a simple person resource, where the JSON response includes a link to the associated address:
var Resource = Resource;var http = http;var cache = cache;var ensure = ensure; var addressResource = ; var people = firstName: "bob" lastName: "smith" id : 1 "job": "tinker" addressId: 3 ; moduleexports = url: "/person/:id" cache: cache respondsTo: http ;
Running Examples
You can run the sample application using the following command:
node --harmony examples\web.js
Features
- Request Handlers - Features like argument population make handling requests easier.
- Caching - HTTP caching of responses to GET requests.
- Validation - Allows validation of request bodies and URL's.