Converted more procedural programming to OOP

This commit is contained in:
2024-12-26 23:34:25 +01:00
parent b7f448cb17
commit e571cf2230
46 changed files with 449 additions and 382 deletions

View File

@ -3,7 +3,6 @@ import express, { Application } from 'express'
import config from '#application/config'
import { getAppPath } from '#application/storage'
import { createServer as httpServer, Server as HTTPServer } from 'http'
import { addHttpRoutes } from './http'
import cors from 'cors'
import { Server as SocketServer } from 'socket.io'
import { Authentication } from '#middleware/authentication'
@ -16,6 +15,7 @@ import CommandManager from '#managers/commandManager'
import QueueManager from '#managers/queueManager'
import DateManager from '#managers/dateManager'
import WeatherManager from '#managers/weatherManager'
import { HttpRouter } from '#http/router'
export class Server {
private readonly app: Application
@ -64,8 +64,9 @@ export class Server {
appLogger.error(`Socket.IO failed to start: ${error.message}`)
}
// Add http API routes
await addHttpRoutes(this.app)
// Load HTTP routes
const httpRouter = new HttpRouter(this.app)
await httpRouter.boot()
// Load queue manager
await QueueManager.boot(this.io)
@ -77,7 +78,7 @@ export class Server {
// await DateManager.boot(this.io)
// Load weather manager
await WeatherManager.boot(this.io)
// await WeatherManager.boot(this.io)
// Load zoneEditor manager
await ZoneManager.boot()