// ghoststandard webhook receiver — long-running process inside the Docker // container. HTTP routes: // POST /webhooks/ghost/:slug Ghost delivers webhooks here, per site // GET /health liveness probe // // Everything else (configuration, manual sync, backfill, status) is the CLI // in src/cli.ts. import { Hono } from 'hono'; import { serve } from '@hono/node-server'; import pc from 'picocolors'; import { webhookRouter } from './routes/webhooks.js'; import { countSites } from './lib/db.js'; const app = new Hono(); app.route('/webhooks', webhookRouter); app.get('/health', (c) => c.json({ ok: true, sites: countSites(), }), ); const port = Number(process.env.GS_PORT ?? 8080); serve({ fetch: app.fetch, port }, (info) => { console.log( `${pc.cyan('ghoststandard')} ${pc.dim('webhook receiver listening on')} http://localhost:${info.port}`, ); const n = countSites(); if (n === 0) { console.log(pc.yellow(' no sites configured yet — run `gs setup` to start.')); } else { console.log(pc.dim(` ${n} site${n === 1 ? '' : 's'} configured.`)); } });