qualiteer/lib/core/server.js

28 lines
711 B
JavaScript
Raw Normal View History

2022-05-05 12:35:47 +00:00
// Imports
import express from "express";
// Routes
import results from "../routes/results-route.js";
2022-05-08 01:36:22 +00:00
import alerting from "../routes/alerting-route.js";
import react from "../routes/react-route.js";
2022-05-17 12:32:04 +00:00
import catalog from "../routes/catalog-route.js";
2022-05-08 01:36:22 +00:00
import jobs from "../routes/jobs-route.js";
2022-05-05 12:35:47 +00:00
2022-05-17 12:32:04 +00:00
import mock from "../routes/mock-route.js";
2022-05-05 12:35:47 +00:00
const app = express();
2022-05-17 12:32:04 +00:00
// Special Routes
2022-05-05 12:35:47 +00:00
app.all("/", (req, res) => res.redirect("/qualiteer"));
2022-05-17 12:32:04 +00:00
if (process.env.MOCK_ROUTES === "true") app.use(mock);
2022-05-05 12:35:47 +00:00
// Middlewares
// Routes
2022-05-08 01:36:22 +00:00
app.use(react); // Static Build Route
2022-05-05 12:35:47 +00:00
app.use("/api/results", results);
2022-05-08 01:36:22 +00:00
app.use("/api/alerting", alerting);
2022-05-17 12:32:04 +00:00
app.use("/api/catalog", catalog);
2022-05-08 01:36:22 +00:00
app.use("/api/jobs", jobs);
2022-05-05 20:30:24 +00:00
export default app;