ff-admin-server/src/routes/index.ts

34 lines
849 B
TypeScript
Raw Normal View History

import express from "express";
2024-08-25 13:36:19 +02:00
import type { Express } from "express";
import cors from "cors";
2024-08-25 13:36:19 +02:00
import allowSetup from "../middleware/allowSetup";
import authenticate from "../middleware/authenticate";
2024-08-25 13:36:19 +02:00
import errorHandler from "../middleware/errorHandler";
2024-10-27 11:47:13 +01:00
import publicAvailable from "./public";
2024-08-25 13:36:19 +02:00
import setup from "./setup";
import auth from "./auth";
2024-09-01 14:55:05 +02:00
import admin from "./admin/index";
2024-11-20 09:32:43 +01:00
import user from "./user";
export default (app: Express) => {
app.set("query parser", "extended");
app.use(express.json());
app.use(
express.urlencoded({
extended: true,
})
);
app.use(cors());
app.options("*", cors());
2024-10-27 11:47:13 +01:00
app.use("/public", publicAvailable);
2024-08-25 13:36:19 +02:00
app.use("/setup", allowSetup, setup);
app.use("/auth", auth);
app.use(authenticate);
2024-09-01 14:55:05 +02:00
app.use("/admin", admin);
2024-11-20 09:32:43 +01:00
app.use("/user", user);
app.use(errorHandler);
};