0.3.0 • Published 9 years ago

koa-aspect v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

koa-aspect

Work in process

Build Status Downloads Version

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
0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago