Arreglo de nombres y rutas
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { type Request, type Response, type NextFunction } from 'express';
|
||||
import { SimUsecases } from './sim-usecases.js';
|
||||
import { MonitorUsecases } from './monitor-usecases.js';
|
||||
import ejs from 'ejs';
|
||||
import path from 'path';
|
||||
|
||||
export class SimController {
|
||||
constructor(private usecases: SimUsecases) {}
|
||||
export class MonitorController {
|
||||
constructor(private usecases: MonitorUsecases) {}
|
||||
|
||||
renderDashboard = async (_req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
@@ -2,7 +2,7 @@ import axios from 'axios';
|
||||
import { type Pool } from 'pg';
|
||||
import { type Proyecto, RepositoryError } from '../domain/common.js';
|
||||
|
||||
export class SimUsecases {
|
||||
export class MonitorUsecases {
|
||||
constructor(private db: Pool) {}
|
||||
|
||||
async checkAllProjectsHealth(): Promise<void> {
|
||||
@@ -1,8 +1,8 @@
|
||||
import express from "express";
|
||||
import type { Request, Response, NextFunction } from "express";
|
||||
import path from "path";
|
||||
import { createRouter } from "./infrastructure/sim-routes-http.js";
|
||||
import { SimUsecases } from "./application/sim-usecases.js";
|
||||
import { createRouter } from "./infrastructure/monitor-routes-http.js";
|
||||
import { MonitorUsecases } from "./application/monitor-usecases.js";
|
||||
import { pool } from "./config/postgreConfig.js";
|
||||
import { AppError } from "./domain/common.js";
|
||||
|
||||
@@ -14,7 +14,7 @@ app.use(express.json());
|
||||
app.set("view engine", "ejs");
|
||||
app.set("views", path.join(process.cwd(), "src/views"));
|
||||
|
||||
const monitorJob = new SimUsecases(pool);
|
||||
const monitorJob = new MonitorUsecases(pool);
|
||||
|
||||
app.use("/", createRouter(monitorJob));
|
||||
|
||||
@@ -49,4 +49,4 @@ app.use((err: Error, req: Request, res: Response, _next: NextFunction) => {
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Server is running on port ${port}`);
|
||||
});
|
||||
});
|
||||
|
||||
10
src/infrastructure/monitor-routes-http.ts
Normal file
10
src/infrastructure/monitor-routes-http.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Router } from 'express';
|
||||
import { MonitorController } from '../application/monitor-controller.js';
|
||||
import { MonitorUsecases } from '../application/monitor-usecases.js';
|
||||
|
||||
export function createRouter(usecases: MonitorUsecases): Router {
|
||||
const router = Router();
|
||||
const controller = new MonitorController(usecases);
|
||||
router.get('/', controller.renderDashboard);
|
||||
return router;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { Router } from 'express';
|
||||
import { SimController } from '../application/sim-controller.js';
|
||||
import { SimUsecases } from '../application/sim-usecases.js';
|
||||
|
||||
export function createRouter(usecases: SimUsecases): Router {
|
||||
const router = Router();
|
||||
const controller = new SimController(usecases);
|
||||
router.get('/', controller.renderDashboard);
|
||||
return router;
|
||||
}
|
||||
Reference in New Issue
Block a user