siren-meddleware
v1.0.0
Published
Configuration-based middleware registration for koa.
Downloads
16
Readme
siren-meddleware
middleware configurator for koa.
Note: This isn't like meddleware, which will return middleware. siren-meddleware carries application and config as arguments and returns the koa APPLICATION.
Usage
var koa = require('koa');
var meddleware = require('meddleware');
var config = require('shush')('./config/middleware');
var app = koa();
meddleware(app, config);
app.listen(3000);
Configuration
Even though the configuration is almost the same as meddleware, many koa middleware need to take application as an argument. To make application injection available, the placeholder '__app' is supported:
{
"middlewareA": {
"enabled": true,
"module": {
"name": "koa-router",
"arguments": [
"__app",
{
"strict": true
}
]
}
}
}
Options, App Events and Middleware Flow Control
Please refer to meddleware, except the app is a koa application.
Tests
$ npm test
Coverage
$ npm test-cov
```