chore: update gitignore for phase02

This commit is contained in:
hibna
2026-02-21 13:22:51 +03:00
parent 2215003a4d
commit 8eb7c90958
16 changed files with 479 additions and 29 deletions
+21
View File
@@ -0,0 +1,21 @@
import fp from 'fastify-plugin';
import type { FastifyInstance } from 'fastify';
import { createDb, type Database } from '@source/database';
declare module 'fastify' {
interface FastifyInstance {
db: Database;
}
}
export default fp(async (app: FastifyInstance) => {
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error('DATABASE_URL environment variable is required');
}
const db = createDb(databaseUrl);
app.decorate('db', db);
app.log.info('Database connected');
});