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 { AuthController } from '#http/controllers/auth'
|
||||||
import { AvatarController } from '#http/controllers/avatar'
|
import { AvatarController } from '#http/controllers/avatar'
|
||||||
|
|
||||||
export class HttpManager {
|
class HttpManager {
|
||||||
private readonly app: Application
|
|
||||||
private readonly authController: AuthController
|
private readonly authController: AuthController
|
||||||
private readonly avatarController: AvatarController
|
private readonly avatarController: AvatarController
|
||||||
private readonly assetsController: AssetsController
|
private readonly assetsController: AssetsController
|
||||||
|
|
||||||
constructor(app: Application) {
|
constructor() {
|
||||||
this.app = app
|
|
||||||
this.authController = new AuthController()
|
this.authController = new AuthController()
|
||||||
this.avatarController = new AvatarController()
|
this.avatarController = new AvatarController()
|
||||||
this.assetsController = new AssetsController()
|
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
|
// Auth routes
|
||||||
this.app.post('/login', (req, res) => this.authController.login(req, res))
|
app.post('/login', (req, res) => this.authController.login(req, res))
|
||||||
this.app.post('/register', (req, res) => this.authController.register(req, res))
|
app.post('/register', (req, res) => this.authController.register(req, res))
|
||||||
this.app.post('/reset-password-request', (req, res) => this.authController.requestPasswordReset(req, res))
|
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('/reset-password', (req, res) => this.authController.resetPassword(req, res))
|
||||||
|
|
||||||
// Avatar routes
|
// Avatar routes
|
||||||
this.app.get('/avatar/:characterName', (req, res) => this.avatarController.getByName(req, res))
|
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/s/:characterTypeId/:characterHairId?', (req, res) => this.avatarController.getByParams(req, res))
|
||||||
|
|
||||||
// Assets routes
|
// Assets routes
|
||||||
this.app.get('/assets/list_tiles', (req, res) => this.assetsController.listTiles(req, res))
|
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))
|
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))
|
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/: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 Logger, { LoggerType } from '#application/logger'
|
||||||
import { getAppPath } from '#application/storage'
|
import { getAppPath } from '#application/storage'
|
||||||
import { TSocket } from '#application/types'
|
import { TSocket } from '#application/types'
|
||||||
import { HttpManager } from '#managers/httpManager'
|
import HttpManager from '#managers/httpManager'
|
||||||
import ConsoleManager from '#managers/consoleManager'
|
import ConsoleManager from '#managers/consoleManager'
|
||||||
import DateManager from '#managers/dateManager'
|
import DateManager from '#managers/dateManager'
|
||||||
import QueueManager from '#managers/queueManager'
|
import QueueManager from '#managers/queueManager'
|
||||||
@ -66,8 +66,7 @@ export class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load HTTP manager
|
// Load HTTP manager
|
||||||
const httpManager = new HttpManager(this.app)
|
await HttpManager.boot(this.app)
|
||||||
await httpManager.boot()
|
|
||||||
|
|
||||||
// Load queue manager
|
// Load queue manager
|
||||||
await QueueManager.boot(this.io)
|
await QueueManager.boot(this.io)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user