Fix module loading issue

merge-requests/1/merge
Matthew 2019-11-16 19:45:39 -05:00
parent 242ade0fbb
commit 820bf7b081
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 2 additions and 3 deletions

View File

@ -28,12 +28,11 @@ export default class Server {
}
private async loadRoutes(): Promise<void> {
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}`);