diff options
Diffstat (limited to 'src/Server.ts')
-rw-r--r-- | src/Server.ts | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/Server.ts b/src/Server.ts index 3e8c9321..3ad794be 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -1,42 +1,28 @@ -import { MongoDatabase, Database } from "lambert-db"; import { Server, ServerOptions } from "lambert-server"; +import { Config, db } from "@fosscord/server-util"; +import path from "path"; -const log = console.log; -console.log = (content) => { - log(`[${new Date().toTimeString().split(" ")[0]}]`, content); -}; - -declare global { - namespace Express { - interface Request { - cdn: CDNServer; - } - } -} - -export interface CDNServerOptions extends ServerOptions { - db: string; -} +export interface CDNServerOptions extends ServerOptions {} export class CDNServer extends Server { - db: Database; public options: CDNServerOptions; - constructor(options: Partial<CDNServerOptions>) { + constructor(options?: Partial<CDNServerOptions>) { super(options); - - this.db = new MongoDatabase(options?.db); } async start() { console.log("[Database] connecting ..."); - await this.db.init(); + // @ts-ignore + await (db as Promise<Connection>); + await Config.init(); console.log("[Database] connected"); + + await this.registerRoutes(path.join(__dirname, "routes")); return super.start(); } async stop() { - await this.db.destroy(); return super.stop(); } } |