0.3.0 • Published 9 years ago
koa-aspect v0.3.0
koa-aspect
Work in process
AOP for "Koa-like" modules.
$ npm i --save koa-aspect
Example
var aspect = require('koa-aspect');
var app = koa();
app.use(function *mw1(next) { yield* next; });
app.use(function *mw2(next) { yield* next; });
app.use(function *lol(next) { yield* next; });
aspect(app, {
wildcard: /^mw/,
before: function *() {
console.log(this.originalUrl);
}
});
app.listen(8080);
API
Join points
before
afterReturning
afterThrowing
after
around