fix AGENTS.md stack ref, add CORS plugin, add .env.example, remove dead index.ts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Fastify from 'fastify';
|
||||
import cors from '@fastify/cors';
|
||||
import { Client as PgClient } from 'pg';
|
||||
import { createClient as createRedisClient } from 'redis';
|
||||
import { DbService } from './services/db.service.js';
|
||||
@@ -28,6 +29,10 @@ export interface AppConfig {
|
||||
export async function buildApp(config: AppConfig) {
|
||||
const fastify = Fastify({ logger: true });
|
||||
|
||||
await fastify.register(cors, {
|
||||
origin: process.env.CORS_ORIGIN?.split(',') || ['http://localhost:5173', 'http://localhost:5174'],
|
||||
});
|
||||
|
||||
const pgClient = new PgClient({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
console.log('Backend starting...');
|
||||
Reference in New Issue
Block a user