Gateway Backend
The gateway backend has several tasks. First, it communicates with the Cups via the MQTT broker. It also writes all relevant data to the MongoDb.
In addition, the gateway communicates with the cloud, it loads user data from the cloud and pushes this data back into the cloud at the end of an event.
Finally, the backend also provides many API endpoints for the frontend.
The following endpoints are provided:
GET /
Returns “Welcome to the Gateway backend!”GET /cup/scan
Performs a nfc scan and returns either a cupid or an errorGET /cup/ping/{id}
Flashes the LED of the corresponding cup for a short timeGET /cup/{id}
Returns a Cup { Id string, Bat int, UserHandle string}POST /cup/{id}/mode
Sets the cup in the corresponding modeGET /cups
Returns all cupsGET /game/{id}
Returns the current gameGET /next
Used for the GuessWho game to fetch a new guess while omitting the already displayed players from the Cloud.GET /winner
Used for the GuessWho game to get the winnerGET /user/{cupId}/disconnect
Disconnects a user form a cup and uploads the data to the Cloud.POST /user/order
Performs a scan and then adds a drink to the scanned userGET /user/{userHandle}/check
Downloads user information from the Cloud.GET /user/{userHandle}/cup/{cupId}/connect
Performs a scan and connects the user by creating/pulling a session in/from the Cloud.GET /leaderboard
Returns the leaderboard of all games
For Demo purposes:
GET /off
Shuts down the LED for all cupsGET /charge
Sets all cups into the charging LED mode