diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 20:54:52 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 20:54:52 +0200 |
commit | e2639379c85714d1925501b80d5e19ce7512463b (patch) | |
tree | 3a99f36672f94dedadcfced52599650d1e4d8d8d /bundle/src | |
parent | :bug: fix util types (diff) | |
download | server-e2639379c85714d1925501b80d5e19ce7512463b.tar.xz |
:bug: fix bundle listen
Diffstat (limited to 'bundle/src')
-rw-r--r-- | bundle/src/Server.ts | 3 | ||||
-rw-r--r-- | bundle/src/start.ts | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index 14abc128..aceabb99 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -9,10 +9,9 @@ import express from "express"; import { Config } from "../../util/dist"; const app = express(); -const server = http.createServer(); +const server = http.createServer(app); const port = Number(process.env.PORT) || 8080; const production = true; -server.on("request", app); // @ts-ignore const api = new APIServer({ server, port, production, app }); diff --git a/bundle/src/start.ts b/bundle/src/start.ts index 2bfb0069..ee012c15 100644 --- a/bundle/src/start.ts +++ b/bundle/src/start.ts @@ -60,6 +60,11 @@ if (cluster.isMaster && !process.env.masterStarted) { console.log(`[Database] started`); console.log(`[Process] running with pid: ${process.pid}`); + if (cores === 1) { + require("./Server.js"); + return; + } + // Fork workers. for (let i = 0; i < cores; i++) { cluster.fork(); |