Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhaogongchengsi/onion
A simple middleware onion model.
https://github.com/zhaogongchengsi/onion
nodejs onion
Last synced: about 2 months ago
JSON representation
A simple middleware onion model.
- Host: GitHub
- URL: https://github.com/zhaogongchengsi/onion
- Owner: zhaogongchengsi
- License: mit
- Created: 2024-06-16T07:01:25.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-11-06T06:56:18.000Z (about 2 months ago)
- Last Synced: 2024-11-06T07:36:27.072Z (about 2 months ago)
- Topics: nodejs, onion
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @zunh/onion
[![npm version][npm-version-src]][npm-version-href]
[![bundle][bundle-src]][bundle-href]
[![JSDocs][jsdocs-src]][jsdocs-href]> A simple middleware onion model.
## Usage
```bash
npm install @zunh/onion
pnpm install @zunh/onion
yarn add @zunh/onion
``````js
import Onion from '@zunh/onion';const onion = new Onion();
onion.use(async (ctx, next) => {
console.log('1');
await next();
console.log('2');
});onion.use(async (ctx, next) => {
console.log('3');
await next();
console.log('4');
});onion.run();
```## License
[MIT](./LICENSE) License © 2023-PRESENT [zhaozunhong](https://github.com/zhaozunhong)
[npm-version-src]: https://img.shields.io/npm/v/@zunh/onion?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/@zunh/onion
[npm-downloads-src]: https://img.shields.io/npm/dm/@zunh/onion?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/@zunh/onion
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@zunh/onion?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=@zunh/onion
[license-src]: https://img.shields.io/github/license/zhaozunhong/@zunh/onion.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/zhaozunhong/@zunh/onion/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
[jsdocs-href]: https://www.jsdocs.io/package/@zunh/onion