Files
iti-technology/apps/api/src/routes/public/health.ts
T
Lorenzo SanesiandClaude Opus 5.5 b83ce039fb
Deploy stack su Proxmox / deploy (push) Failing after 3s
Piattaforma ITI TECHNOLOGY: monorepo, Medusa, API, sito, area riservata e deploy
Monorepo npm con apps/public (Angular SSR), apps/private (Angular SPA),
apps/api (Fastify), packages/shared e packages/styles; Medusa 2.21 in medusa/;
infrastruttura Docker (Postgres PostGIS+pgvector, Redis, Caddy, backup) e
workflow Gitea Actions per il deploy via SSH a ogni push su master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018jQyT6dR9czzGwqb7FkG6u
2026-10-20 09:30:48 +02:00

29 lines
791 B
TypeScript

import type { FastifyPluginAsyncZod } from "fastify-type-provider-zod"
import { z } from "zod"
const healthResponse = z.object({
status: z.literal("ok"),
uptime: z.number(),
timestamp: z.iso.datetime(),
})
/** GET /health — liveness per Docker/Caddy. Escluso dal rate limit. */
const healthRoutes: FastifyPluginAsyncZod = async (app) => {
app.get(
"/health",
{
config: { rateLimit: false },
// Healthcheck Docker ogni 15 s: niente righe "incoming request"/"request completed" nei log (errori sì)
logLevel: "warn",
schema: { response: { 200: healthResponse } },
},
async () => ({
status: "ok" as const,
uptime: Math.round(process.uptime()),
timestamp: new Date().toISOString(),
}),
)
}
export default healthRoutes