*Need to create express before booting server

This commit is contained in:
Derrick Hammer 2022-09-21 09:08:30 -04:00
parent 8ab43c9e3a
commit 31a785b13e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ export function setRouter(newRouter: express.Router): void {
} }
export async function start() { export async function start() {
app = express();
server = http.createServer(app); server = http.createServer(app);
await new Promise((resolve) => { await new Promise((resolve) => {
server.listen(80, "0.0.0.0", function () { server.listen(80, "0.0.0.0", function () {
@ -27,7 +28,7 @@ export async function start() {
resolve(null); resolve(null);
}); });
}); });
app = express();
app.use(function (req, res, next) { app.use(function (req, res, next) {
router(req, res, next); router(req, res, next);
}); });