Skip to content

Tyler-Washington888/ACC-Basketball-Conference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ACC-Basketball-Conference


Project Overview

ACC-Basketball-Conference is a backend app I built to gain experience using MySQL in tandem with Node.js and Express. In this project users have access to the acc_basketball_conference database where they can perform full crud operations on both the Teams and Players table. Additonally, they can utilize the relationships between the tables to find the number of players on each team.


Libraries and Dependencies

Library Description
Express back-end framework for building RESTful APIs in Node.js
colors color-management system used to style NodeJS console
MySQL open-source relational database management system
cors allows a server to indicate any origins from which a browser should permit loading resources
nodemon command-line tool that automatically restarts app when it detects changes

ERD Model

Dummy Link


Code Showcase

This middleware function 'getNumOfPlayers' was my favorite snippet from this project. It allowed me to show the number of players on each team by performing a right join.

//@desc GET number of players on each team
//@route GET /numofplayers
//@access Public 

const getNumOfPlayers = (async (req, res) => {
    let sql = `SELECT Teams.TeamName AS Team, COUNT(Players.PlayerID) AS "Num of Players" FROM Players RIGHT JOIN Teams ON Players.TeamID = Teams.TeamID GROUP BY TeamName ORDER BY Teams.TeamName`;
    let query = await db.query(sql, (err, teams) => {
      if(err) throw err;
      res.status(200).json(teams)
    })
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published