ColinLefter / Accord

A real-time privacy-first social media platform leveraging feature-rich direct messaging text channels. Built as part of the course project for COSC 310 at UBC.
5 stars 1 forks source link

Docstring format for TypeScript #68

Open ColinLefter opened 6 months ago

ColinLefter commented 6 months ago

Please refer to the following format when writing function docstrings:

/**
 * [description]
 *
 * @param [parameter name] - [Description of the parameter]
 */
export function demoFunction() { }

Components

  1. The docstring goes above the function
  2. It has a brief description of what the function does
  3. All parameters are mentioned and detailed accordingly

Example

/**
 * Handles the POST request for user login, validating the user credentials against the database.
 * Responds with a success message and status code 200 if the credentials are valid, or an error
 * message and status code 401 for invalid credentials, and 500 for any internal server errors.
 *
 * @param req - The incoming Next.js API request object, containing the username and password.
 * @param res - The outgoing Next.js API response object used to send back the result.
 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) { }
Hocng7 commented 6 months ago

Very good structure for our team to follow to keep our code organized, readable, and easier to modify if needed. Excellent work, Colin!