Uecko_ERP/apps/server/src/infrastructure/app.ts

31 lines
720 B
TypeScript
Raw Normal View History

2025-01-30 10:45:31 +00:00
import dotenv from "dotenv";
2025-01-29 16:01:17 +00:00
import express, { Application } from "express";
import helmet from "helmet";
2025-01-30 10:45:31 +00:00
import responseTime from "response-time";
import { authRoutes } from "./express";
2025-01-29 16:01:17 +00:00
dotenv.config();
export function createApp(): Application {
const app = express();
// secure apps by setting various HTTP headers
app.use(helmet());
app.disable("x-powered-by");
// Middlewares
app.use(express.json());
app.use(express.text());
app.use(express.urlencoded({ extended: true }));
// set up the response-time middleware
app.use(responseTime());
app.set("port", process.env.PORT ?? 3002);
2025-01-30 10:45:31 +00:00
// Registrar rutas del módulo de autenticación
app.use("/api/auth", authRoutes);
2025-01-29 16:01:17 +00:00
return app;
}