fix AGENTS.md stack ref, add CORS plugin, add .env.example, remove dead index.ts

This commit is contained in:
kami
2026-07-14 01:36:25 +04:00
parent 737bf19fd1
commit 42474c65fd
4 changed files with 43 additions and 1 deletions
+37
View File
@@ -8,6 +8,7 @@
"name": "muzick-backend",
"version": "0.1.0",
"dependencies": {
"@fastify/cors": "^11.3.0",
"bullmq": "^5.1.0",
"fastify": "^4.24.3",
"pg": "^8.11.3",
@@ -519,6 +520,26 @@
"fast-uri": "^2.0.0"
}
},
"node_modules/@fastify/cors": {
"version": "11.3.0",
"resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-11.3.0.tgz",
"integrity": "sha512-ggQGua+xHv1MvePbPr0v//xLYEsCXbWspquXCJS9Ot5YoRXq8J8ZWzHnxDBVnbtXosvistXo6LtNzOJswf64Fw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "MIT",
"dependencies": {
"fastify-plugin": "^6.0.0",
"toad-cache": "^3.7.0"
}
},
"node_modules/@fastify/error": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/@fastify/error/-/error-3.4.1.tgz",
@@ -1684,6 +1705,22 @@
"toad-cache": "^3.3.0"
}
},
"node_modules/fastify-plugin": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-6.0.0.tgz",
"integrity": "sha512-fZOty7z3O7vOliF6d8bHE3wiEh1KcNnKEQensSgTk9C1DvN6nRLS++XVd86v33Hw/8u9Un8A1zDrQ8ujcQDHEg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "MIT"
},
"node_modules/fastq": {
"version": "1.20.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
+1
View File
@@ -13,6 +13,7 @@
"setup-db": "./scripts/setup-db.sh"
},
"dependencies": {
"@fastify/cors": "^11.3.0",
"bullmq": "^5.1.0",
"fastify": "^4.24.3",
"pg": "^8.11.3",
+5
View File
@@ -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
View File
@@ -1 +0,0 @@
console.log('Backend starting...');