Files
geo/src/index.ts
T
Ruslan Bakiev 34e56080b6
Build and deploy Docker image / build (push) Successful in 1m47s
Decouple GEO from Exchange
2026-09-28 12:29:24 +07:00

26 lines
792 B
TypeScript

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)`);