Moved the 404 route to the server.ts

This commit is contained in:
Mathias Wagner 2023-06-18 15:00:15 +02:00
parent bb0a7aad64
commit afbdd16816
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -1,6 +1,7 @@
import express, { Application } from "express";
import express, { Application, Request, Response } from "express";
import mongoose, { CallbackError } from "mongoose";
import v1Router from "./routes/v1";
import { sendError } from "@utils/error";
const MONGOOSE_STRING = process.env.MONGOOSE_STRING || "mongodb://localhost:27017";
@ -17,6 +18,8 @@ app.use("/", v1Router); // <- Newest
app.use("/v1/", v1Router);
app.use("*", (req: Request, res: Response) => sendError(res, 404, 0, "The provided route could not be found"));
// Configure mongoose
mongoose.set("strictQuery", false);