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:
parent
3fe2c8bfa8
commit
f7e3809d7e
10968
package-lock.json
generated
10968
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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" });
|
||||||
|
Loading…
Reference in New Issue
Block a user