summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-16 21:03:32 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-16 21:03:32 +0100
commit2ffca731bdcdbb034fc581314716f56f46a691a2 (patch)
treee522b4d7214de29d6e8821d4d227a915290dd232
parent:bug: fix error handler (diff)
downloadserver-2ffca731bdcdbb034fc581314716f56f46a691a2.tar.xz
:bug: fix db connect
-rw-r--r--package-lock.json5
-rw-r--r--src/Server.ts3
-rw-r--r--src/middlewares/GlobalRateLimit.ts1
-rw-r--r--src/middlewares/RateLimit.ts1
4 files changed, 5 insertions, 5 deletions
diff --git a/package-lock.json b/package-lock.json

index de52a66c..fbb4c303 100644 --- a/package-lock.json +++ b/package-lock.json
@@ -7,6 +7,7 @@ "": { "name": "fosscord-api", "version": "1.0.0", + "hasInstallScript": true, "license": "ISC", "dependencies": { "bcrypt": "^5.0.0", @@ -1362,7 +1363,7 @@ }, "node_modules/fosscord-server-util": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#637cfa6010dd00a399463f5a14869c169960d6e6", + "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#7e25f67878a632529334f75677be76c474240a53", "license": "ISC", "dependencies": { "jsonwebtoken": "^8.5.1", @@ -5076,7 +5077,7 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, "fosscord-server-util": { - "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#637cfa6010dd00a399463f5a14869c169960d6e6", + "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#7e25f67878a632529334f75677be76c474240a53", "from": "fosscord-server-util@github:fosscord/fosscord-server-util", "requires": { "jsonwebtoken": "^8.5.1", diff --git a/src/Server.ts b/src/Server.ts
index fa4111db..d08794c8 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -10,6 +10,7 @@ import i18nextMiddleware, { I18next } from "i18next-http-middleware"; import i18nextBackend from "i18next-node-fs-backend"; import { ErrorHandler } from "./middlewares/ErrorHandler"; import { BodyParser } from "./middlewares/BodyParser"; +import mongoose from "mongoose"; export interface DiscordServerOptions extends ServerOptions {} @@ -42,7 +43,7 @@ export class DiscordServer extends Server { async start() { // @ts-ignore - await (db as Promise<Connection>); + await mongoose.connect(process.env.MONGO_URL); await this.setupSchema(); console.log("[DB] connected"); await Promise.all([Config.init()]); diff --git a/src/middlewares/GlobalRateLimit.ts b/src/middlewares/GlobalRateLimit.ts
index 544bfdd8..fc121911 100644 --- a/src/middlewares/GlobalRateLimit.ts +++ b/src/middlewares/GlobalRateLimit.ts
@@ -1,6 +1,5 @@ import { NextFunction, Request, Response } from "express"; import Config from "../util/Config"; -import { db } from "fosscord-server-util"; // TODO: use mongodb ttl index // TODO: increment count on serverside diff --git a/src/middlewares/RateLimit.ts b/src/middlewares/RateLimit.ts
index f4b76dfe..ab541b74 100644 --- a/src/middlewares/RateLimit.ts +++ b/src/middlewares/RateLimit.ts
@@ -1,5 +1,4 @@ import { NextFunction, Request, Response } from "express"; -import { db } from "fosscord-server-util"; import { getIpAdress } from "./GlobalRateLimit";