Add API router, index
CI/CD Pipeline / test (push) Failing after 1m47s
CI/CD Pipeline / deploy-internal (push) Has been skipped

This commit is contained in:
chris committed 2026-08-28 20:19:35 -04:00
1 parent fea861f042
commit 223ab79d21
4 files changed
+94 -2

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import express from 'express';
import { Pool } from 'pg';
import { CategoryRepository } from './category.repository.ts';
import { createCategoryRouter } from './category.router.ts';
const app = express();
const port = process.env.API_PORT || 8300;
// Initialize your database pool
const pool = new Pool({
connectionString: process.env.DATABASE_URL
});
app.use(express.json());
// Inject the database pool into the repository layer
const categoryRepository = new CategoryRepository(pool);
// Attach your category endpoints to the Express app
app.use('/api/categories', createCategoryRouter(categoryRepository));
app.listen(port, () => {
console.log(`🚀 API workspace server running smoothly on http://localhost:${port}`);
});