1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix 404 error return json instead of client

This commit is contained in:
Flam3rboy 2021-07-22 14:04:24 +02:00
parent 3fe2c8bfa8
commit f7e3809d7e
2 changed files with 10940 additions and 62 deletions

10968
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -103,6 +103,14 @@ export class FosscordServer extends Server {
app.use("/api/v8", prefix); app.use("/api/v8", prefix);
app.use("/api/v9", prefix); app.use("/api/v9", prefix);
app.use("/api", prefix); // allow unversioned requests app.use("/api", prefix); // allow unversioned requests
prefix.get("*", (req: Request, res: Response) => {
res.status(404).json({
message: "404: Not Found",
code: 0
});
});
this.app = app; this.app = app;
this.app.use(ErrorHandler); this.app.use(ErrorHandler);
const indexHTML = fs.readFileSync(path.join(__dirname, "..", "client_test", "index.html"), { encoding: "utf8" }); const indexHTML = fs.readFileSync(path.join(__dirname, "..", "client_test", "index.html"), { encoding: "utf8" });