Moved the 404 route to the server.ts
This commit is contained in:
parent
bb0a7aad64
commit
afbdd16816
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user