Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielwpz/crepecake-common
Commonly-used middlewares for crepecake
https://github.com/danielwpz/crepecake-common
Last synced: 14 days ago
JSON representation
Commonly-used middlewares for crepecake
- Host: GitHub
- URL: https://github.com/danielwpz/crepecake-common
- Owner: danielwpz
- License: mit
- Created: 2019-01-16T22:58:02.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T01:06:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T13:37:15.702Z (about 2 months ago)
- Language: JavaScript
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crepecake-common
Commonly-used middlewares for crepecake.
## Default middlewares
1. compress: https://github.com/koajs/compress
2. helmet: https://github.com/venables/koa-helmet
3. logger: https://github.com/danielwpz/logger
4. bodyparser: https://github.com/koajs/bodyparser
5. cors: https://github.com/koajs/cors## Examples
1. Use default middlewares
```javascript
const common = require('crepecake-common');
const app = new CrepeCake();app.use(common());
```2. Config default middlewares
```javascript
const common = require('crepecake-common');
const app = new CrepeCake();app.use(common({
helmet: {...helmet options},
bodyparser: {...bodyparser options}
}));
```3. Use custom middlewares
```javascript
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
}));
```