summary refs log tree commit diff
path: root/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-01-01 22:26:20 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-01-01 22:26:20 +0100
commite5f35fbdf901387d82b285f41ec87b1d1d2b3a69 (patch)
tree49ec23da615b5cc116e5ca655693c1afaad05dac /src/Server.ts
parent:tada: standard client finished (diff)
downloadserver-e5f35fbdf901387d82b285f41ec87b1d1d2b3a69.tar.xz
:bug: fix
Diffstat (limited to 'src/Server.ts')
-rw-r--r--src/Server.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Server.ts b/src/Server.ts

index ca03e0d2..92c73a35 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -1,7 +1,6 @@ import express, { Application, Router } from "express"; import { traverseDirectory } from "./Utils"; import { Server as HTTPServer } from "http"; -import fetch from "node-fetch"; import fs from "fs/promises"; export type ServerOptions = { @@ -56,13 +55,13 @@ export class Server { var router = require(file); if (router.router) router = router.router; if (router.default) router = router.default; - if (!router || router.prototype.constructor.name !== "router") + if (!router || router?.prototype?.constructor?.name !== "router") throw `File doesn't export any default router`; this.app.use(path, <Router>router); console.log(`[Server] Route ${path} registerd`); return router; } catch (error) { - console.error(new Error(`[Server] Failed to register route ${file}: ${error}`)); + console.error(new Error(`[Server] Failed to register route ${path}: ${error}`)); } }