Changeset ebf5e04 for pages/api/postgre
- Timestamp:
- 06/12/22 18:31:03 (3 years ago)
- Branches:
- main
- Children:
- 285c3cc
- Parents:
- fe03f69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pages/api/postgre/index.js
rfe03f69 rebf5e04 13 13 14 14 const sessions = [] 15 // example session 16 // const session = { 17 // id, 18 // displayName, 19 // username, 20 // credits, 21 // lastActivity, 22 // } 23 15 // example session = { id, displayName, username, credits, lastActivity } 24 16 25 17 export default function handler(req, res) { … … 30 22 /** 31 23 * /---------------------- GET ----------------------/ 24 * If the player won credits, update them in the database. 25 * Also, update the stats in the database. 32 26 * @action give_credits 33 27 * @param session_id … … 95 89 /** 96 90 * /---------------------- GET ----------------------/ 91 * The player lost credits, update this in the database. 97 92 * @action take_credits 98 93 * @param session_id … … 138 133 /** 139 134 * /---------------------- GET ----------------------/ 135 * Get stats for the player, so we can display them in the front end. 140 136 * @action get_stats 141 137 * @param session_id … … 174 170 /** 175 171 * /---------------------- GET ----------------------/ 172 * Returns the player's room, if the player was in one. 173 * Same as the one below, but this one is used in a game-specific context. 176 174 * @action get_player_info_on_enter 177 175 * @param session_id … … 198 196 /** 199 197 * /---------------------- GET ----------------------/ 198 * Returns the player's room, if the player was in one. 199 * Same as the one above, but this one is used in a general context. 200 200 * @action check_if_logged_in 201 201 * @param session_id … … 222 222 /** 223 223 * /---------------------- GET ----------------------/ 224 * Takes the credits in the player's session, and updates the database. 225 * Logs the player out and kills the session. 224 226 * @action logout 225 227 * @param session_id … … 254 256 /** 255 257 * /---------------------- POST ----------------------/ 258 * Checks if the entered account info is good, and registers a new user in the database if so. 256 259 * @action register 257 260 * @param username … … 339 342 /** 340 343 * /---------------------- POST ----------------------/ 344 * Checks if the entered account info is good, and logs the user in if so. 341 345 * @action login 342 346 * @param username … … 433 437 } 434 438 } 435 436 /**437 * PUT method438 */439 if (req.method === 'PUT') {440 441 }442 439 }
Note:
See TracChangeset
for help on using the changeset viewer.