Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koajs/timer
time your middleware
https://github.com/koajs/timer
Last synced: 2 months ago
JSON representation
time your middleware
- Host: GitHub
- URL: https://github.com/koajs/timer
- Owner: koajs
- Created: 2015-10-15T07:43:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-09-13T05:17:15.000Z (about 3 years ago)
- Last Synced: 2024-04-14T13:08:40.802Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 26
- Watchers: 8
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
- awesome-koa - timer - time your middleware (Middleware)
README
# koa-timer
time your middleware
![img](https://cldup.com/E2OA3LEane.png)
## Install
```
npm install koa-timer
```## Example
See the [example](examples/index.js).
## API
#### `timer = Timer(options)`
Initialize a timer with the following options:
- slow (default 75): set what "slow" middleware means to your app
- debug (default "koa:timer"): the debug namespace you want to use
- threshold (default: false): only display middleware that's slower than the threshold
- verbose (default: false): setting to true will show the timing before and after `yield next`Then to instrument the middleware, you do the following:
```js
app.use(timer(middleware()))
```## License
MIT