interface Response
extends [http.ServerResponse]

The response a route handler receives: node's, plus a JSON shorthand.

// Defined, not invoked: a real response comes from the server's own dispatch.
function ok(res: Response) {
  return res.json({ ok: true });
}

Properties

json: (data: unknown) => void

Responds with data as application/json and ends the response.

Usage

import { type Response } from "lib/web/index.ts";