1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-21 18:21:36 +02: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

10994
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/v9", prefix);
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.use(ErrorHandler);
const indexHTML = fs.readFileSync(path.join(__dirname, "..", "client_test", "index.html"), { encoding: "utf8" });