diff --git a/src/controller/MatchController.ts b/src/controller/MatchController.ts index d23dd03..9e4923b 100644 --- a/src/controller/MatchController.ts +++ b/src/controller/MatchController.ts @@ -54,6 +54,10 @@ export class MatchController { } } + getMatchCount() { + return Object.keys(this.matches).length; + } + async receiveMatchData(data: IAuthedData) { if (data.timestamp == null) { data.timestamp = Date.now(); diff --git a/src/index.ts b/src/index.ts index b9a139d..cfb9db2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import { WebsocketIncoming } from "./connector/websocketIncoming"; import express from "express"; import logging from "./util/Logging"; +import { MatchController } from "./controller/MatchController"; const Log = logging("Status"); // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -10,7 +11,8 @@ const app = express(); const port = 5101; app.get("/status", (req, res) => { - res.json({ status: "UP" }); + const status = { status: "UP", matchesRunning: MatchController.getInstance().getMatchCount() }; + res.json(status); }); app.listen(port, () => {