Add auth router and service to api index
This commit is contained in:
1 parent
3d7be239d6
commit
ec5924fda9
1 file changed
+5
@@ -4,6 +4,9 @@ import { CategoryRepository } from './category.repository.ts';
|
|||||||
import { createCategoryRouter } from './category.router.ts';
|
import { createCategoryRouter } from './category.router.ts';
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
import { createAuthRouter } from './auth.router.ts';
|
||||||
|
import { AuthService } from './auth.service.ts';
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
process.loadEnvFile(join(import.meta.dirname, '../.env'));
|
process.loadEnvFile(join(import.meta.dirname, '../.env'));
|
||||||
@@ -13,6 +16,7 @@ try {
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.API_PORT || 8300;
|
const port = process.env.API_PORT || 8300;
|
||||||
|
const authService = new AuthService();
|
||||||
|
|
||||||
// Initialize your database pool
|
// Initialize your database pool
|
||||||
const pool = new Pool({
|
const pool = new Pool({
|
||||||
@@ -20,6 +24,7 @@ const pool = new Pool({
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
app.use('/api/auth', createAuthRouter(pool, authService));
|
||||||
|
|
||||||
// Inject the database pool into the repository layer
|
// Inject the database pool into the repository layer
|
||||||
const categoryRepository = new CategoryRepository(pool);
|
const categoryRepository = new CategoryRepository(pool);
|
||||||
|
|||||||
Reference in new issue
Block a user