httpManager now matches manager format
This commit is contained in:
parent
e1ff2fefe1
commit
f5c4f3df19
@ -4,34 +4,39 @@ import { AssetsController } from '#http/controllers/assets'
|
||||
import { AuthController } from '#http/controllers/auth'
|
||||
import { AvatarController } from '#http/controllers/avatar'
|
||||
|
||||
export class HttpManager {
|
||||
private readonly app: Application
|
||||
class HttpManager {
|
||||
private readonly authController: AuthController
|
||||
private readonly avatarController: AvatarController
|
||||
private readonly assetsController: AssetsController
|
||||
|
||||
constructor(app: Application) {
|
||||
this.app = app
|
||||
constructor() {
|
||||
this.authController = new AuthController()
|
||||
this.avatarController = new AvatarController()
|
||||
this.assetsController = new AssetsController()
|
||||
}
|
||||
|
||||
public async boot() {
|
||||
public async boot(app: Application) {
|
||||
// Add routes
|
||||
await this.addRoutes(app)
|
||||
}
|
||||
|
||||
private async addRoutes(app: Application) {
|
||||
// Auth routes
|
||||
this.app.post('/login', (req, res) => this.authController.login(req, res))
|
||||
this.app.post('/register', (req, res) => this.authController.register(req, res))
|
||||
this.app.post('/reset-password-request', (req, res) => this.authController.requestPasswordReset(req, res))
|
||||
this.app.post('/reset-password', (req, res) => this.authController.resetPassword(req, res))
|
||||
app.post('/login', (req, res) => this.authController.login(req, res))
|
||||
app.post('/register', (req, res) => this.authController.register(req, res))
|
||||
app.post('/reset-password-request', (req, res) => this.authController.requestPasswordReset(req, res))
|
||||
app.post('/reset-password', (req, res) => this.authController.resetPassword(req, res))
|
||||
|
||||
// Avatar routes
|
||||
this.app.get('/avatar/:characterName', (req, res) => this.avatarController.getByName(req, res))
|
||||
this.app.get('/avatar/s/:characterTypeId/:characterHairId?', (req, res) => this.avatarController.getByParams(req, res))
|
||||
app.get('/avatar/:characterName', (req, res) => this.avatarController.getByName(req, res))
|
||||
app.get('/avatar/s/:characterTypeId/:characterHairId?', (req, res) => this.avatarController.getByParams(req, res))
|
||||
|
||||
// Assets routes
|
||||
this.app.get('/assets/list_tiles', (req, res) => this.assetsController.listTiles(req, res))
|
||||
this.app.get('/assets/list_tiles/:zoneId', (req, res) => this.assetsController.listTilesByZone(req, res))
|
||||
this.app.get('/assets/list_sprite_actions/:spriteId', (req, res) => this.assetsController.listSpriteActions(req, res))
|
||||
this.app.get('/assets/:type/:spriteId?/:file', (req, res) => this.assetsController.downloadAsset(req, res))
|
||||
app.get('/assets/list_tiles', (req, res) => this.assetsController.listTiles(req, res))
|
||||
app.get('/assets/list_tiles/:zoneId', (req, res) => this.assetsController.listTilesByZone(req, res))
|
||||
app.get('/assets/list_sprite_actions/:spriteId', (req, res) => this.assetsController.listSpriteActions(req, res))
|
||||
app.get('/assets/:type/:spriteId?/:file', (req, res) => this.assetsController.downloadAsset(req, res))
|
||||
}
|
||||
}
|
||||
|
||||
export default new HttpManager()
|
@ -10,7 +10,7 @@ import Database from '#application/database'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { getAppPath } from '#application/storage'
|
||||
import { TSocket } from '#application/types'
|
||||
import { HttpManager } from '#managers/httpManager'
|
||||
import HttpManager from '#managers/httpManager'
|
||||
import ConsoleManager from '#managers/consoleManager'
|
||||
import DateManager from '#managers/dateManager'
|
||||
import QueueManager from '#managers/queueManager'
|
||||
@ -66,8 +66,7 @@ export class Server {
|
||||
}
|
||||
|
||||
// Load HTTP manager
|
||||
const httpManager = new HttpManager(this.app)
|
||||
await httpManager.boot()
|
||||
await HttpManager.boot(this.app)
|
||||
|
||||
// Load queue manager
|
||||
await QueueManager.boot(this.io)
|
||||
|
Loading…
x
Reference in New Issue
Block a user