# @tinyhttp/ping

> Response time checker middleware

Latest version **2.0.0** (published 2021-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tinyhttp/ping
pnpm add @tinyhttp/ping
yarn add @tinyhttp/ping
bun add @tinyhttp/ping
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-08-22 |
| First published | 2020-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12.4 \|\| 14.x \|\| >=16 |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | v1rtl |
| Maintainers | dropthebeatbro |
| Keywords | tinyhttp, node.js, web framework, web, backend, ping, x-response-time, middleware, performance |

## Links

- npm: https://www.npmjs.com/package/@tinyhttp/ping
- Repository: https://github.com/tinyhttp/ping
- Homepage: https://github.com/tinyhttp/ping#readme
- Issues: https://github.com/tinyhttp/ping/issues
- npm.io page: https://npm.io/package/@tinyhttp/ping

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-08-22
- 1.3.0 — 2021-04-26
- 1.2.3 — 2021-04-14
- 1.2.2 — 2021-04-02
- 1.2.1 — 2021-03-26
- 1.2.0 — 2021-02-21
- 1.1.1 — 2021-01-13
- 1.1.0 — 2020-12-21
- 1.0.7 — 2020-12-12
- 1.0.6 — 2020-12-12
- 1.0.5 — 2020-12-11
- 1.0.4 — 2020-12-11
- 1.0.3 — 2020-12-09
- 1.0.2 — 2020-12-09
- 1.0.1 — 2020-11-28
- … 12 more at https://npm.io/package/@tinyhttp/ping/versions

## README

<div align="center">

# @tinyhttp/ping

[![npm][npm-img]][npm-url] [![GitHub Workflow Status][gh-actions-img]][github-actions] [![Coverage][cov-img]][cov-url]

</div>

> Inspired by [koa-response-time](https://github.com/koajs/response-time)

Response time checker for tinyhttp. Sets `X-Response-Time` header using `process.hrtime()`

## Install

```sh
pnpm i @tinyhttp/ping
```

## API

```js
import { ping } from '@tinyhttp/ping'
```

### Options

#### `round`

Round the ping time. Default is set to true.

## Example

```js
import { ping } from '@tinyhttp/ping'
import { createServer } from 'http'
import path from 'path'

createServer(async (req, res) => {
  ping()(req, res)
  res.end('Hello World')
}).listen(3000)
```

[npm-url]: https://npmjs.com/package/@tinyhttp/ping
[github-actions]: https://github.com/tinyhttp/ping/actions
[gh-actions-img]: https://img.shields.io/github/workflow/status/tinyhttp/ping/CI?style=for-the-badge&logo=github&label=&color=hotpink
[cov-img]: https://img.shields.io/coveralls/github/tinyhttp/ping?style=for-the-badge&color=hotpink
[cov-url]: https://coveralls.io/github/tinyhttp/ping
[npm-img]: https://img.shields.io/npm/dt/@tinyhttp/ping?style=for-the-badge&color=hotpink

---
_Source: https://npm.io/package/@tinyhttp/ping · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
