This commit is contained in:
hibna
2026-02-21 13:02:41 +03:00
commit 2215003a4d
59 changed files with 6100 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import Fastify from 'fastify';
import cors from '@fastify/cors';
import cookie from '@fastify/cookie';
const app = Fastify({
logger: {
transport: {
target: 'pino-pretty',
},
},
});
await app.register(cors, {
origin: process.env.CORS_ORIGIN || 'http://localhost:5173',
credentials: true,
});
await app.register(cookie);
app.get('/api/health', async () => {
return { status: 'ok', timestamp: new Date().toISOString() };
});
const PORT = Number(process.env.PORT) || 3000;
const HOST = process.env.HOST || '0.0.0.0';
try {
await app.listen({ port: PORT, host: HOST });
app.log.info(`API server running on http://${HOST}:${PORT}`);
} catch (err) {
app.log.error(err);
process.exit(1);
}