summary refs log tree commit diff
path: root/api/src/Server.ts
diff options
context:
space:
mode:
authoruurgothat <cckhmck@gmail.com>2021-10-17 21:49:46 +0300
committeruurgothat <cckhmck@gmail.com>2021-10-17 21:49:46 +0300
commitdb3d6e116a3b49669103abdf5f2d156b2c78c3c4 (patch)
tree1a1a5f4d03ca5d0b94ca5f47456e7cd536ba21e7 /api/src/Server.ts
parentMerge branch 'master' of https://github.com/fosscord/fosscord-server (diff)
parentUpdate README.md (diff)
downloadserver-db3d6e116a3b49669103abdf5f2d156b2c78c3c4.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to 'api/src/Server.ts')
-rw-r--r--api/src/Server.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/api/src/Server.ts b/api/src/Server.ts

index 12c1d6b4..a6887fd4 100644 --- a/api/src/Server.ts +++ b/api/src/Server.ts
@@ -1,19 +1,17 @@ -import { OptionsJson } from "body-parser"; import "missing-native-js-functions"; -import { Connection } from "mongoose"; import { Server, ServerOptions } from "lambert-server"; import { Authentication, CORS } from "./middlewares/"; import { Config, initDatabase, initEvent } from "@fosscord/util"; import { ErrorHandler } from "./middlewares/ErrorHandler"; import { BodyParser } from "./middlewares/BodyParser"; import { Router, Request, Response, NextFunction } from "express"; -import mongoose from "mongoose"; import path from "path"; import { initRateLimits } from "./middlewares/RateLimit"; import TestClient from "./middlewares/TestClient"; import { initTranslation } from "./middlewares/Translation"; import morgan from "morgan"; import { initInstance } from "./util/Instance"; +import { registerRoutes } from "@fosscord/util"; export interface FosscordServerOptions extends ServerOptions {} @@ -75,12 +73,12 @@ export class FosscordServer extends Server { await initRateLimits(api); await initTranslation(api); - this.routes = await this.registerRoutes(path.join(__dirname, "routes", "/")); + this.routes = await registerRoutes(this, path.join(__dirname, "routes", "/")); api.use("*", (error: any, req: Request, res: Response, next: NextFunction) => { if (error) return next(error); res.status(404).json({ - message: "404: Not Found", + message: "404 endpoint not found", code: 0 }); next();