forked from noxious/server
Router is now httpManager
This commit is contained in:
37
src/managers/httpManager.ts
Normal file
37
src/managers/httpManager.ts
Normal 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))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user