In this project, i have to create the backend for a football leaderboard. The front end has already been completed, and i had to develop the API according to its requirements and business rules.
I just do the backend of the aplication.
The frontend run in port 3000.
The backend run in port 3001.
- Git.
- NPM - v >= 7.0
- Docker
# Clone the repo
git clone https://github.com/caiobacode/footbal-leaderboard.git
# Enter in repo
cd footbal-leaderboard
#install dependencies
npm run install:apps
# Run DockerCompose
npm run compose:up
# Go to the backend folder and populate the database.
cd app/backend
npm run db:reset
# enter in backend folder
cd app/backend
# run tests
npm run test
🌐 API routes
Leaderboard Route
- GET "/leaderboard/home" - Return the leaderboard of the teams that played at home.
- GET "/leaderboard/away" - Return the leaderboard of the teams that not played at home.
- GET "/leaderboard" - Returns the both leaderboard.
Login Route
- POST "/login" - Login the user if the fields are correct.
- GET "/login/role" - Return the user role(admin or user).
Matches Route
- GET "/matches" - Returns all motorcycles
- PATCH "/matches/:id/finish" - Finish the match.
- PATCH "/matches/:id" - Update the match score.
- POST "/matches" - Start a match with the teams passed by request.
Teams Route
- GET "/teams" - Returns all teams.
- GET "/teams/:id" - Returns the team that has the id passed by the request.
✏️ What i learned
-
OOP (Object-Oriented-Programing) in typescript.
-
How to develop backend for a finished front end.
-
How to run a full stack aplication with docker.