use camelcase file names from now on...
This commit is contained in:
@ -1,22 +1,24 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import express, { Application } from 'express'
|
||||
import { createServer as httpServer } from 'http'
|
||||
import { addHttpRoutes } from './utilities/Http'
|
||||
import { createServer as httpServer, Server as HTTPServer } from 'http'
|
||||
import { addHttpRoutes } from './utilities/http'
|
||||
import cors from 'cors'
|
||||
import { Server as SocketServer } from 'socket.io'
|
||||
import { TSocket } from './utilities/Types'
|
||||
import config from './utilities/Config'
|
||||
import prisma from './utilities/Prisma'
|
||||
import ZoneManager from './managers/ZoneManager'
|
||||
import UserManager from './managers/UserManager'
|
||||
import { Authentication } from './middleware/Authentication'
|
||||
import CommandManager from './managers/CommandManager'
|
||||
import { TSocket } from './utilities/types'
|
||||
import config from './utilities/config'
|
||||
import prisma from './utilities/prisma'
|
||||
import ZoneManager from './managers/zoneManager'
|
||||
import UserManager from './managers/userManager'
|
||||
import { Authentication } from './middleware/authentication'
|
||||
// import CommandManager from './managers/CommandManager'
|
||||
import { Dirent } from 'node:fs'
|
||||
import logger from './utilities/logger'
|
||||
|
||||
|
||||
export class Server {
|
||||
private readonly app: Application
|
||||
private readonly http: any
|
||||
private readonly http: HTTPServer
|
||||
private readonly io: SocketServer
|
||||
|
||||
/**
|
||||
@ -39,17 +41,17 @@ export class Server {
|
||||
// Check prisma connection
|
||||
try {
|
||||
await prisma.$connect()
|
||||
console.log('[✅] Database connected')
|
||||
logger.info('Database connected')
|
||||
} catch (error: any) {
|
||||
throw new Error(`[❌] Database connection failed: ${error.message}`)
|
||||
logger.error(`Database connection failed: ${error.message}`)
|
||||
}
|
||||
|
||||
// Start the server
|
||||
try {
|
||||
await this.http.listen(config.PORT, config.HOST)
|
||||
console.log('[✅] Socket.IO running on port', config.PORT)
|
||||
logger.info(`Socket.IO running on port ${config.PORT}`)
|
||||
} catch (error: any) {
|
||||
throw new Error(`[❌] Socket.IO failed to start: ${error.message}`)
|
||||
logger.error(`Socket.IO failed to start: ${error.message}`)
|
||||
}
|
||||
|
||||
// Add http API routes
|
||||
@ -78,7 +80,7 @@ export class Server {
|
||||
try {
|
||||
await this.loadEventHandlers(eventsPath, socket)
|
||||
} catch (error: any) {
|
||||
throw new Error('[❌] Failed to load event handlers: ' + error.message)
|
||||
logger.error(`Failed to load event handlers: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,3 +103,5 @@ export class Server {
|
||||
// Start the server
|
||||
const server = new Server()
|
||||
server.start()
|
||||
|
||||
console.log('Server started')
|
Reference in New Issue
Block a user