Skip to content

yiminghe/falcor-koa-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    };
  }
},
{
  route: 'app2',
  // promise
  get() {
    return new Promise(function(resolve) {
      setTimeout(function(){
        resolve({
          path:['app2'],
          value: 'xx'
        })
      },1000);
    });
  }
}
])));

About

falcor router middleware for koa

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published