```js
app.use((ctx, next) => {
let path = ctx.path;
let action = path.slice(path.lastIndexOf('/'));
path = path.slice(0, path.lastIndexOf('/'));
let include = false;
for (let key in koahub.controller) {
if (key == path) {
include = true;
break;
}
}
if (include) {
let ctrl = koahub.controller[path];
let pros = Object.getOwnPropertyNames(ctrl.prototype);
for (let k in pros) {
if ('/' + pros[k] == action) {
Object.getPrototypeOf(new ctrl())[pros[k]].call(this);
}
}
} else {
ctx.throw(404);
}
});
```