crepecake-common
v1.0.0
Published
Commonly-used middlewares for crepecake
Downloads
34
Readme
crepecake-common
Commonly-used middlewares for crepecake.
Default middlewares
- compress: https://github.com/koajs/compress
- helmet: https://github.com/venables/koa-helmet
- logger: https://github.com/danielwpz/logger
- bodyparser: https://github.com/koajs/bodyparser
- cors: https://github.com/koajs/cors
Examples
- Use default middlewares
const common = require('crepecake-common');
const app = new CrepeCake();
app.use(common());
- Config default middlewares
const common = require('crepecake-common');
const app = new CrepeCake();
app.use(common({
helmet: {...helmet options},
bodyparser: {...bodyparser options}
}));
- Use custom middlewares
const common = require('crepecake-common');
const app = new CrepeCake();
app.use(common({
bodyparser: false, // set false will disable the default middleware
myBodyparser: (ctx, next) => {...} // add your own
}));