koa-mounter
v0.0.4
Published
a wrapper for koa-mount to mount multi app in one middleware
Downloads
6
Readme
koa-mounter
a wrapper for koa-mount to mount multi app in one middleware
have bugs, use koa-mount instead
Usage
var koa = require('koa');
var mounter = require('koa-mounter');
var server = koa();
var server1 = koa();
var server2 = koa();
server1.use(function *(next){
this.body = 'api server';
});
server2.use(function *(next){
this.body = '3 number server';
});
server.use(mounter({
'/api': server1,
'/100': server2
}));
server.use(function *(next){
this.body = 'default server';
});
server.listen(3000);
Then write to your /etc/hosts
127.0.0.1 example.com
Then request example.com/api
will return api server
;
request example.com/100
will return 3 number server
;
request example.com/other
will return default server
License
MIT