Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

public-stats.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.

public-stats.tsBlame30 lines · 1 contributor
52ad8b1Claude1/**
2 * Block L4 — Public stats API endpoint.
3 *
4 * GET /api/v2/stats
5 *
6 * Public, no auth, CORS-open (inherits `/api/*` cors from `app.tsx`).
7 * Returns the same `PublicStats` JSON shape rendered on the marketing
8 * landing page. Cached at the lib layer (5 min in-memory LRU); the
9 * response carries `Cache-Control: public, max-age=300` so CDN /
10 * browser caches can hold it too.
11 *
12 * The handler never throws — `computePublicStats` degrades to all-zeros
13 * on DB error, so a 200 with zeros is the worst case here.
14 */
15
16import { Hono } from "hono";
17import { computePublicStats } from "../lib/public-stats";
18
19const publicStats = new Hono();
20
21publicStats.get("/api/v2/stats", async (c) => {
22 const stats = await computePublicStats();
23 c.header("cache-control", "public, max-age=300");
24 return c.json({
25 ...stats,
26 asOf: stats.asOf.toISOString(),
27 });
28});
29
30export default publicStats;