Nonlinear Programming Methods
Miss any of our Open RFC calls?Watch the recordings here! »

falcor-koa-router

0.1.2 • Public • Published

falcor-koa-router

falcor router middleware for koa

usage

var router = require('falcor-koa-router');
var mount = require('koa-mount');
// array format referred to https://github.com/Netflix/falcor-router
app.use(mount('model.json', router.routes([
{
  route: 'app',
  // generator function
  get: function* (){
    yield wait(100);
    return {
      path: ['app'],
      // this.ctx: koa context
      value: this.ctx.url
    };
  }
},
{
  router: 'app2',
  // promise
  get() {
    return new Promise(function(resolve) {
      setTimeout(function(){
        resolve({
          path:[app2],
          value: 'xx'
        })
      },1000);
    });
  }
}
])));

Install

npm i falcor-koa-router

DownloadsWeekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • avatar