Tower Route
A routing system built on KoaJS and Co. It uses JavaScript generators to provide amazing synchronous style programming.
The tower routing system also comes with a router, a view engine, and some helper modules: name.
Requirements
- Node v0.11.7
- Harmony generator flag
node --harmony-generators
You can alias it in your.bashrc
or.zshrc
until Node has it built in.
Install
NPM: (Not in npm yet)
npm install tower-route
Usage
var route = require('tower-route');
// GET route.
route.get('api.index', '/api')
.action(function*(){
this.type = 'text/html';
this.body = '<h1>Hello World</h1>';
});
// GET route.
route.get('api.index', '/api')
.action(function*(){
var results = yield db.query("SELECT users.id FROM `users`");
});
API
Please refer to the implementation for now.
Test
All tests use Mocha.
mocha
License
MIT