import express from "express"; import type { Express } from "express"; import cors from "cors"; import allowSetup from "../middleware/allowSetup"; import authenticate from "../middleware/authenticate"; import errorHandler from "../middleware/errorHandler"; import publicAvailable from "./public"; import setup from "./setup"; import invite from "./invite"; import reset from "./reset"; import auth from "./auth"; import admin from "./admin/index"; 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()); 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); app.use("/api/admin", admin); app.use("/api/user", user); app.use(errorHandler); };