diff --git a/package.json b/package.json index 90491f99..c3b195b3 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "ajv": "^8.5.0", "dotenv": "^8.2.0", "jsonwebtoken": "^8.5.1", - "lambert-server": "^1.1.7", + "lambert-server": "^1.2.7", "missing-native-js-functions": "^1.2.3", "mongoose-autopopulate": "^0.12.3", "node-fetch": "^2.6.1", diff --git a/src/Server.ts b/src/Server.ts index a88214ef..a0a2926e 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -10,9 +10,12 @@ export class Server { public ws: WebSocketServer; public port: number; public server: http.Server; + public production: boolean; - constructor({ port, server }: { port: number; server?: http.Server }) { + constructor({ port, server, production }: { port: number; server?: http.Server; production?: boolean }) { this.port = port; + this.production = production || false; + if (server) this.server = server; else this.server = http.createServer({}); @@ -34,8 +37,10 @@ export class Server { await this.setupSchema(); await Config.init(); console.log("[DB] connected"); - if (!this.server.listening) this.server.listen(this.port); - console.log(`[Gateway] online on 0.0.0.0:${this.port}`); + if (!this.server.listening) { + this.server.listen(this.port); + console.log(`[Gateway] online on 0.0.0.0:${this.port}`); + } } async stop() {