made typescript my bitch
This commit is contained in:
@ -8,6 +8,7 @@ import config from './app/utilities/config';
|
||||
import prisma from './app/utilities/prisma';
|
||||
import api from "./app/utilities/api";
|
||||
import ZoneManager from "./app/ZoneManager";
|
||||
import UserManager from "./app/UserManager";
|
||||
|
||||
export class Server
|
||||
{
|
||||
@ -54,6 +55,9 @@ export class Server
|
||||
// Add API routes
|
||||
await api.addAuthRoutes(this.app);
|
||||
|
||||
// Load user manager
|
||||
await UserManager.boot();
|
||||
|
||||
// Load zone manager
|
||||
await ZoneManager.boot();
|
||||
|
||||
@ -70,16 +74,12 @@ export class Server
|
||||
const eventsPath = path.join(__dirname, 'app', 'events');
|
||||
try {
|
||||
const files: string[] = await fs.promises.readdir(eventsPath);
|
||||
await Promise.all(files.map(async (file) => {
|
||||
try {
|
||||
const module = await import(path.join(eventsPath, file));
|
||||
module.default(socket, this.io);
|
||||
} catch (error: any) {
|
||||
console.error(`[❌] Failed to load event handler ${file}: ${error.message}`);
|
||||
}
|
||||
}));
|
||||
for (const file of files) {
|
||||
const module = await import(path.join(eventsPath, file));
|
||||
module.default(socket, this.io);
|
||||
}
|
||||
} catch (error: any) {
|
||||
throw new Error('[❌] Failed to read event handlers directory: ' + error.message);
|
||||
throw new Error('[❌] Failed to load event handlers: ' + error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user