Destination Framework
Painless API Creation Framework for Node.js w/ Database Agnostic Adapters.
Installation
npm install destination
Usage
Include the Destination Framework
var Destination = require('destination');
Install an Adapter, and start an objective:
var Objective = Destination.start(, {
name: 'adapter name such as (mongodb)',
... Adapter Settings ...
});
Start defining objective Models, Property schema curtesy of Validator.
var User = Objective.define('User', {
collection: true,
routing: {
fetch: { by: 'name' },
fetchAll: false,
create: true,
update: false,
remove: false,
upsert: false,
empty: false,
count: false
},
name: {
type: String,
length: {
min: 3,
max: 24
}
},
password: {
type: String,
length: {
min: 3,
max: 36
}
}
});
Models currently only have two keywords in the root document:
Anything else is used as a property schema, processed and parsed by Validator upon requests,
refer to validator for schema documentation.
It's extremely simple. I promise. Now you listen:
Objective.listen(1337);
You don't even have to use the Objective variable to listen, you can use your application framework to do it and it will still work. :)
Adapters
Todo
- Find a way to support any application framework instead of Express.