From 820bf7b081ee009a32a847cbf38dc00b458d23d3 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 16 Nov 2019 19:45:39 -0500 Subject: [PATCH] Fix module loading issue --- src/api/Server.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/Server.ts b/src/api/Server.ts index 988c605..cd65289 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -28,12 +28,11 @@ export default class Server { } private async loadRoutes(): Promise { - console.log(__dirname); - const routes = await fs.readdir('./routes'); + const routes = await fs.readdir(`${__dirname}/routes`); routes.forEach(async (routeFile) => { if (routeFile === 'index.js') return; try { - const route: Route = new (require(`./${routeFile}`))(this); + const route: Route = new (require(`${__dirname}/routes/${routeFile}`))(this); this.routes.set(route.conf.path, route); this.app.use(route.conf.path, route.router); this.client.signale.success(`Successfully loaded route ${route.conf.path}`);