30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { Express, Request, Response } from "express";
|
|
import { setupAdminRoutes } from "../admin/routes.js";
|
|
import { setupAuthRoutes } from "../auth/routes/routes.js";
|
|
import { setupForkliftRoutes } from "../forklifts/routes/routes.js";
|
|
import { setupLogisticsRoutes } from "../logistics/routes.js";
|
|
import { setupSystemRoutes } from "../system/routes.js";
|
|
import { setupMobileRoutes } from "../mobile/route.js";
|
|
import { setupDataMartRoutes } from "../datamart/routes/routes.js";
|
|
|
|
export const setupRoutes = (app: Express, basePath: string) => {
|
|
// all routes
|
|
setupAuthRoutes(app, basePath);
|
|
setupAdminRoutes(app, basePath);
|
|
setupSystemRoutes(app, basePath);
|
|
setupLogisticsRoutes(app, basePath);
|
|
setupForkliftRoutes(app, basePath);
|
|
setupMobileRoutes(app, basePath);
|
|
setupDataMartRoutes(app, basePath)
|
|
|
|
// 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" });
|
|
});
|
|
};
|