This repo contains all the source code to run the micro API for the sports analytics dashboard SportSee.
It should be used alongside this repository
Follow the instructions in the above link readme to use it.
Original readme :
To start this project, you are free to use Docker or not. In this documentation, we will see several methods to launch the project easily.
If you are working with several versions of NodeJS, we recommend you install nvm. This tool will allow you to easily manage your NodeJS versions.
- Fork the repository
- Clone it on your computer.
- The
yarn
command will allow you to install the dependencies. - The
yarn dev
command will allow you to run the micro API.
- The
docker image build --no-cache -t micro-api .
command will allow you to build your image. - The
docker container run --name micro-api -p 3000:3000 -dt micro-api yarn
command will allow you to create your Docker container and run your image on port 3000. - The
docker container stop micro-api
command will allow you to stop your micro-api. - The
docker container rm micro-api
command will allow you to delete your micro-api container.
Finally, if you have VsCode, you can easily launch your project in a docker environment.
You will need the Remote Development extension. Once you have this extension installed, just click on the Reopen in Container
button.
Once in the container, run the yarn dev
command.
This project includes four endpoints that you will be able to use:
http://localhost:3000/user/${userId}
- retrieves information from a user. This first endpoint includes the user id, user information (first name, last name and age), the current day's score (todayScore) and key data (calorie, macronutrient, etc.).http://localhost:3000/user/${userId}/activity
- retrieves a user's activity day by day with kilograms and calories.http://localhost:3000/user/${userId}/average-sessions
- retrieves the average sessions of a user per day. The week starts on Monday.http://localhost:3000/user/${userId}/performance
- retrieves a user's performance (energy, endurance, etc.).
Warning, currently only two users have been mocked. They have userId 12 and 18 respectively.
http://localhost:3000/user/12/performance
- Retrieves the performance of the user with id 12http://localhost:3000/user/18
- Retrieves user 18's main information.