npm.io
2.0.0 • Published 5 years ago

@tinyhttp/ping

Licence
MIT
Version
2.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
9

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'

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

Keywords