From: xangelo Date: Sat, 21 Oct 2023 03:09:27 +0000 (-0400) Subject: feat: extend Express.Request to include base RL object X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=9859ef8913245dbde6829ccee002df029abe6e69;p=risinglegends.git feat: extend Express.Request to include base RL object The `rl` property on `Express.Request` provides a standard way to access the cache and socket server objects across requests. This allows us to split up the routes into multiple files for easier development. --- diff --git a/src/types/express/index.d.ts b/src/types/express/index.d.ts index 9f12cde..f04dcbf 100644 --- a/src/types/express/index.d.ts +++ b/src/types/express/index.d.ts @@ -1,7 +1,14 @@ import { Player } from '../../shared/player'; +import { Server } from 'socket.io'; + +interface RL { + cache: Map, + io: Server +} declare module 'express-serve-static-core' { interface Request { - player: Player + player: Player, + rl: RL } }