Mise à jour de index.js

This commit is contained in:
soufiane 2025-11-03 22:19:36 +01:00
parent a19dbfdd4b
commit 622053c08e

View File

@ -9,7 +9,6 @@ import { pool } from "./db.js";
dotenv.config(); dotenv.config();
const app = express(); const app = express();
// --- Middlewares globaux ---
app.use( app.use(
cors({ cors({
origin: ["http://localhost:3000", "https://dsp5-archi-o24a-15m-g3.fr"], origin: ["http://localhost:3000", "https://dsp5-archi-o24a-15m-g3.fr"],
@ -20,11 +19,6 @@ app.use(helmet());
app.use(morgan("tiny")); app.use(morgan("tiny"));
app.use(express.json()); app.use(express.json());
// --- Endpoint de santé pour CI/CD et monitoring ---
app.get("/health", (req, res) => {
res.status(200).json({ status: "ok" });
});
// --- Vérification connexion DB --- // --- Vérification connexion DB ---
app.get("/db-check", async (req, res) => { app.get("/db-check", async (req, res) => {
try { try {
@ -35,9 +29,14 @@ app.get("/db-check", async (req, res) => {
} }
}); });
// --- Route daccueil (fix pour 'Cannot GET /') --- // --- Route santé ---
app.get("/health", (req, res) => {
res.status(200).json({ status: "ok" });
});
// --- Route daccueil ---
app.get("/", (req, res) => { app.get("/", (req, res) => {
res.json({ message: "✅ API Thé Tip Top en ligne et opérationnelle vk1001001 !" }); res.json({ message: "✅ API Thé Tip Top en ligne et opérationnelle g1001001 !" });
}); });
// --- Monitoring Prometheus --- // --- Monitoring Prometheus ---