five-on-it / apps/api/src/games
apps/api/src/games
The published games' routes (TECHNICAL_SPECS §9.6, GAME_DESIGN §10.3): the list (search and sorting), a game's page (its missions, its rating, the caller's own stars), its versions, its preview picture, its rooms, and what players do with a game: rate it, report it, remix it into a draft of their own.
| Route | Who | What |
|---|---|---|
GET /games?q=&sort=new|top|featured | anyone | The public games (and the caller's own), the words found in titles, blurbs, creators and levels; each says whether the caller made it (own). |
GET /games?owner=me, GET /games?friends=1 | signed in | The caller's games, whatever their visibility (Your games); the caller's friends' public and link-shared games. |
GET /games/:id, GET /games/:id/versions | anyone | A game's page; its versions, oldest first. |
GET /games/:id/preview.png, GET /previews/:hash.png | anyone | The latest version's preview; any preview by its hash (cached for good). |
GET /games/:id/rooms, POST /games/:id/rooms, POST /rooms/:id/join | anyone; signed in | Its open rooms; open one (a public game's moderated); join one. A party's leader brings the party along. |
PUT /games/:id/rating {stars} | signed in | One rating per account and game, guests too; never one's own game. |
POST /games/:id/reports {reason, text?} | signed in | A report, for the moderators (takedowns.ts). |
POST /games/:id/remix | creator | The latest version's game and level spec copied into a new draft, credited. |
POST /games/:id/missions/:mission/runs | signed in | A run of one of its missions, in a room of its own, for the caller or their party (runs.ts). |
A game's page lists each mission with how it is played (its mode and its players). A game a moderator took down is unlisted and answers 410 to anyone but its creator and the moderators; its rooms take no new players. A curated game is a level that ships with its bundled game (main-*, the main menu's), by the level's name: it has a page (by Five On It, its missions, no rating, remix nor report), its Play joins the level's room (GET /play), and its missions' runs open on the level itself (bundled).