1
0
forked from noxious/server

Router is now httpManager

This commit is contained in:
2024-12-28 21:33:32 +01:00
parent 5c94584cb2
commit baf0350102
2 changed files with 8 additions and 8 deletions

View File

@ -0,0 +1,37 @@
import { Application } from 'express'
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
private readonly authController: AuthController
private readonly avatarController: AvatarController
private readonly assetsController: AssetsController
constructor(app: Application) {
this.app = app
this.authController = new AuthController()
this.avatarController = new AvatarController()
this.assetsController = new AssetsController()
}
public async boot() {
// 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))
// 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))
// 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))
}
}