Bsian 2019-11-17 00:45:59 +00:00
commit dde33ce76b
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 3 deletions

View File

@ -28,12 +28,11 @@ export default class Server {
} }
private async loadRoutes(): Promise<void> { private async loadRoutes(): Promise<void> {
console.log(__dirname); const routes = await fs.readdir(`${__dirname}/routes`);
const routes = await fs.readdir('./routes');
routes.forEach(async (routeFile) => { routes.forEach(async (routeFile) => {
if (routeFile === 'index.js') return; if (routeFile === 'index.js') return;
try { 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.routes.set(route.conf.path, route);
this.app.use(route.conf.path, route.router); this.app.use(route.conf.path, route.router);
this.client.signale.success(`Successfully loaded route ${route.conf.path}`); this.client.signale.success(`Successfully loaded route ${route.conf.path}`);