Blame · Line-by-line history
version.ts
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 05cdb85 | 1 | /** |
| 2 | * /api/version — public build-info endpoint. | |
| 3 | * | |
| 4 | * Returns the running process's commit SHA, branch, boot time, and uptime | |
| 5 | * as a tiny JSON payload. Used by: | |
| 6 | * - The client-side auto-update banner (polls every 15s, prompts reload | |
| 7 | * when sha changes) | |
| 8 | * - Operators sanity-checking 'did my push actually deploy?' | |
| 9 | * - Monitoring (latency to seeing a new sha = end-to-end deploy time) | |
| 10 | * | |
| 11 | * Cache-control: no-store. Must be live, never cached. | |
| 12 | */ | |
| 13 | ||
| 14 | import { Hono } from "hono"; | |
| 15 | import { getBuildInfo } from "../lib/build-info"; | |
| 16 | ||
| 17 | const version = new Hono(); | |
| 18 | ||
| 19 | version.get("/api/version", (c) => { | |
| 20 | c.header("cache-control", "no-store, no-cache, must-revalidate"); | |
| 21 | c.header("pragma", "no-cache"); | |
| 22 | return c.json(getBuildInfo()); | |
| 23 | }); | |
| 24 | ||
| 25 | export default version; |