Skip to main content

GET /status

Returns the current server status and the number of active matches. This endpoint is useful for health checks and monitoring.

Endpoint

GET /status

Authentication

No authentication required. This is a public endpoint.

Response

status
string
required
Server status. Returns "UP" when the server is running.
matchesRunning
number
required
The number of currently active matches on the server.

Response Example

{
  "status": "UP",
  "matchesRunning": 3
}

Status Codes

  • 200 - Success

Implementation

From src/index.ts:22-25:
app.get("/status", (req: Request, res: Response) => {
  const status = { 
    status: "UP", 
    matchesRunning: MatchController.getInstance().getMatchCount() 
  };
  res.header("Access-Control-Allow-Origin", "*").json(status);
});
The matchesRunning count is retrieved from the MatchController which tracks all active match sessions.

Use Cases

Health Monitoring

Use this endpoint in your monitoring system to verify server availability:
curl http://localhost:5101/status

Load Balancing

Check match count before routing new connections:
curl -s http://localhost:5101/status | jq '.matchesRunning'

Docker Health Check

Add to your docker-compose.yml:
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:5101/status"]
  interval: 30s
  timeout: 10s
  retries: 3

Example Requests

curl http://localhost:5101/status

Notes

  • This endpoint always returns 200 OK when the server is running
  • The matchesRunning counter is updated in real-time
  • Matches are automatically removed after 30 minutes of inactivity
  • CORS headers are included for browser-based requests

Build docs developers (and LLMs) love