19 lines
584 B
TypeScript
19 lines
584 B
TypeScript
import type { Express, Request, Response } from "express";
|
|
|
|
import healthRoutes from "./routes/healthRoutes.js";
|
|
|
|
export const setupRoutes = (app: Express, basePath: string) => {
|
|
// Root / health check
|
|
app.use(basePath + "/health", healthRoutes);
|
|
|
|
// always try to go to the app weather we are in dev or in production.
|
|
app.get(basePath + "/", (req: Request, res: Response) => {
|
|
res.redirect(basePath + "/app");
|
|
});
|
|
|
|
// Fallback 404 handler
|
|
app.use((req: Request, res: Response) => {
|
|
res.status(404).json({ error: "Not Found" });
|
|
});
|
|
};
|