managarten/packages/shared-hono/src/health.ts
Till JS 32939fbfb5 refactor(infra): remove zitare + clock NestJS backends, add shared-hono package
Both apps are fully local-first via Dexie.js + mana-sync. Their NestJS
backends were pure CRUD wrappers (20 + 31 source files) that are no
longer needed.

Changes:
- Add packages/shared-hono: JWT auth via JWKS (jose), Drizzle DB factory,
  health route, generic GDPR admin handler, error middleware
- Migrate zitare lists page from fetch() to listsStore (local-first)
- Rewrite clock timers store from API-based to timerCollection (Dexie)
- Update clock +layout.svelte CommandBar search to use local collections
- Remove zitare-backend + clock-backend from docker-compose, CI/CD,
  Prometheus, env generation, setup scripts
- Add docs/TECHNOLOGY_AUDIT_2026_03.md with full repo analysis

Net result: -2 Docker containers, -2 ports, -2728 lines of code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 22:43:46 +01:00

36 lines
775 B
TypeScript

/**
* Health check route for Hono servers.
*
* Returns JSON compatible with the NestJS HealthModule format
* so monitoring/health-checks work without changes.
*/
import { Hono } from 'hono';
const startTime = Date.now();
/**
* Create a health check route.
*
* Usage:
* ```ts
* import { healthRoute } from '@manacore/shared-hono/health';
* app.route('/health', healthRoute('calendar-server'));
* ```
*/
export function healthRoute(serviceName: string, version?: string): Hono {
const route = new Hono();
route.get('/', (c) =>
c.json({
status: 'ok',
service: serviceName,
runtime: 'bun',
timestamp: new Date().toISOString(),
uptime: Math.floor((Date.now() - startTime) / 1000),
...(version ? { version } : {}),
})
);
return route;
}