import Fastify from "fastify"; import cors from "@fastify/cors"; import mercurius from "mercurius"; import { typeDefs, resolvers } from "./schema.js"; import { registerIngestionRoutes } from "./ingest.js"; import { ensureGraph } from "./db.js"; const PORT = Number.parseInt(process.env.PORT || "8000", 10); const app = Fastify(); await ensureGraph(); await app.register(cors, { origin: ["https://optovia.ru"], credentials: true }); await app.register(mercurius, { schema: typeDefs, resolvers, path: "/graphql/public", graphiql: true, }); await registerIngestionRoutes(app); app.get("/health", async () => ({ status: "ok" })); await app.listen({ port: PORT, host: "0.0.0.0" }); console.log(`Geo server ready on port ${PORT}`); console.log(` /graphql/public - public (no auth)`);