Files
photoreport/apps/api/src/server.ts
T
spark 7f2782a4c8
ci / rust (push) Successful in 4m4s
ci / typescript (push) Failing after 7m25s
feat(sports): import youth national friendlies and a Cloud M19 folder
Recent FPA posts supply the next youth camp, so a call-up is not a one-off list. Tonight's Portugal–Spain under-19 game can be picked, and Cloud M19 delivers it under Seleções Nacionais/M19.
2026-11-05 19:56:19 +00:00

31 lines
996 B
TypeScript

import { ensureCloudM19Target } from "./delivery/fpa-m19.js";
import { preferIpv4 } from "./lib/prefer-ipv4.js";
import { buildApp, reporterFor } from "./app.js";
import { loadConfig } from "./config.js";
import { createDb } from "./db.js";
preferIpv4();
const config = loadConfig();
const db = createDb(config.DATABASE_URL, config.API_DB_POOL_SIZE);
const reporter = reporterFor(config);
reporter.watchProcess("api");
const app = await buildApp({ config, db, realtime: "socket", reporter });
const shutdown = async (signal: string) => {
app.log.info({ signal }, "shutting down");
await app.close();
await db.$disconnect();
process.exit(0);
};
process.on("SIGTERM", () => void shutdown("SIGTERM"));
process.on("SIGINT", () => void shutdown("SIGINT"));
ensureCloudM19Target(db).catch((err) => app.log.warn({ err }, "delivery: Cloud M19 profile not created"));
try {
await app.listen({ port: config.PORT, host: "0.0.0.0" });
} catch (err) {
app.log.error(err);
process.exit(1);
}