@tinyhttp/ping

npm (scoped) npm

Inspired by koa-response-time

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

Install

pnpm i @tinyhttp/ping

API

import { ping } from '@tinyhttp/ping'

Options

round

Round the ping time. Default is set to true.

Example

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

const server = http.createServer(async (req, res) => {
  ping()(req, res)
  res.end('Hello World')
})

server.listen(3000)

License

MIT © v1rtl

Install

pnpm i @tinyhttp/ping

Version

0.0.3

Source

packages/ping