Changeset ebf5e04 for pages/api/postgre


Ignore:
Timestamp:
06/12/22 18:31:03 (3 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
285c3cc
Parents:
fe03f69
Message:

Code cleanings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/api/postgre/index.js

    rfe03f69 rebf5e04  
    1313
    1414const 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 }
    2416
    2517export default function handler(req, res) {
     
    3022    /**
    3123     * /---------------------- GET ----------------------/
     24     * If the player won credits, update them in the database.
     25     * Also, update the stats in the database.
    3226     * @action give_credits
    3327     * @param session_id
     
    9589    /**
    9690     * /---------------------- GET ----------------------/
     91     * The player lost credits, update this in the database.
    9792     * @action take_credits
    9893     * @param session_id
     
    138133    /**
    139134     * /---------------------- GET ----------------------/
     135     * Get stats for the player, so we can display them in the front end.
    140136     * @action get_stats
    141137     * @param session_id
     
    174170    /**
    175171     * /---------------------- 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.
    176174     * @action get_player_info_on_enter
    177175     * @param session_id
     
    198196    /**
    199197     * /---------------------- 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.
    200200     * @action check_if_logged_in
    201201     * @param session_id
     
    222222    /**
    223223     * /---------------------- GET ----------------------/
     224     * Takes the credits in the player's session, and updates the database.
     225     * Logs the player out and kills the session.
    224226     * @action logout
    225227     * @param session_id
     
    254256    /**
    255257     * /---------------------- POST ----------------------/
     258     * Checks if the entered account info is good, and registers a new user in the database if so.
    256259     * @action register
    257260     * @param username
     
    339342    /**
    340343     * /---------------------- POST ----------------------/
     344     * Checks if the entered account info is good, and logs the user in if so.
    341345     * @action login
    342346     * @param username
     
    433437    }
    434438  }
    435 
    436   /**
    437    * PUT method
    438    */
    439   if (req.method === 'PUT') {
    440 
    441   }
    442439}
Note: See TracChangeset for help on using the changeset viewer.