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

38 lines
995 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";
2024-11-23 14:25:31 +01:00
import invite from "./invite";
2024-11-23 12:11:19 +01:00
import reset from "./reset";
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-11-27 17:06:41 +01:00
app.use("/api/public", publicAvailable);
app.use("/api/setup", allowSetup, setup);
app.use("/api/reset", reset);
app.use("/api/invite", invite);
app.use("/api/auth", auth);
app.use(authenticate);
2024-11-27 17:06:41 +01:00
app.use("/api/admin", admin);
app.use("/api/user", user);
app.use(errorHandler);
};