Skip to main content

Room Details API - src/pages/api/room/[gameId].ts

GET /api/room/[gameId]. Gets all information needed for the game state

handler(req: NextApiRequest, res: NextApiResponse): Promise<void>

Method: GET only. Returns 405 for any other method.

Query { gameId } = req.body;

Returns: { problem, gameType, status, teams, teamId, role }

Preconditions:

  • Must be signed in
  • Game must have been created

Error responses:

StatusConditionBody
405Non-GET or Non-PUT request{ error: "Method not allowed" }
401Not authorized{ error: "Not authorized" }
500Failed to create/update database{ message: 'Failed to create game room' }