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

28 lines
601 B
TypeScript
Raw Normal View History

import express from "express";
import cors from "cors";
import type { Express } from "express";
import errorHandler from "../middleware/errorHandler";
import authenticate from "../middleware/authenticate";
import auth from "./auth";
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("/auth", auth);
app.use(authenticate);
app.use("/secured", (req, res) => {
res.send("hallo");
});
app.use(errorHandler);
};