1
0
forked from noxious/server

POC working new caching method - moved controllers folder, renamed assets to textures, fixed HTTP bug, formatted code

This commit is contained in:
2025-01-07 03:58:32 +01:00
parent f47023dc81
commit 010454914b
25 changed files with 131 additions and 137 deletions

View File

@ -1,20 +1,25 @@
import { Application } from 'express'
import { AssetsController } from '#http/controllers/assets'
import { AuthController } from '#http/controllers/auth'
import { AvatarController } from '#http/controllers/avatar'
import { AssetsController } from '#controllers/assets'
import { AuthController } from '#controllers/auth'
import { AvatarController } from '#controllers/avatar'
import { CacheController } from '#controllers/cache'
import { TexturesController } from '#controllers/textures'
/**
* HTTP manager
*/
class HttpManager {
private readonly authController: AuthController
private readonly avatarController: AvatarController
private readonly assetsController: AssetsController
constructor() {
this.authController = new AuthController()
this.avatarController = new AvatarController()
this.assetsController = new AssetsController()
}
private readonly authController: AuthController = new AuthController()
private readonly avatarController: AvatarController = new AvatarController()
private readonly assetsController: AssetsController = new AssetsController()
private readonly texturesController: TexturesController = new TexturesController()
private readonly cacheController: CacheController = new CacheController()
/**
* Initialize HTTP manager
* @param app
*/
public async boot(app: Application) {
// Add routes
await this.addRoutes(app)
@ -35,7 +40,13 @@ class HttpManager {
app.get('/assets/list_tiles', (req, res) => this.assetsController.listTiles(req, res))
app.get('/assets/list_tiles/:mapId', (req, res) => this.assetsController.listTilesByMap(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))
// Download texture file
app.get('/textures/:type/:spriteId?/:file', (req, res) => this.texturesController.download(req, res))
// Cache routes
app.get('/cache/maps', (req, res) => this.cacheController.maps(req, res))
app.get('/cache/map_objects', (req, res) => this.cacheController.mapObjects(req, res))
}
}