Files
backend/src/server.ts
Ruslan Bakiev f956148141
All checks were successful
Build and deploy Backend / build (push) Successful in 1m1s
Add Telegram ownership for voice reviews
2026-05-08 16:44:32 +07:00

29 lines
679 B
TypeScript

import Fastify from 'fastify';
import mercurius from 'mercurius';
import { config } from './config.js';
import { prisma } from './prisma.js';
import { resolvers, schema } from './graphql/schema.js';
const app = Fastify({ logger: true });
app.register(mercurius, {
schema,
resolvers,
graphiql: true,
context: async (request) => {
const header = request.headers['x-telegram-init-data'];
return {
telegramInitData: Array.isArray(header) ? header[0] : header,
};
},
});
app.get('/health', async () => ({ ok: true }));
app.addHook('onClose', async () => {
await prisma.$disconnect();
});
await app.listen({ host: config.host, port: config.port });