Something went wrong. Try again.
Ghost is lightweight headless server that enables Ghost self hosters to bridge to standard.site with ease..
Something went wrong. Try again.
1.1 kB · 38 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839// 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.`)); }});