The objective of this repository is to develop an application that fulfills the user stories created by the @Rubcube team.
Based on the user stories, I created the functional requirements and the business requirements.
You can see the stories and rules created from them in the roadmap.
- Typescript
- tsup (to transpile from TypeScript to JavaScript)
- Node.js
- Fastify (Framework used in this application)
- Zod (Schema validator)
- Vite (Used for tests)
- Husky (Pre-commit tests, only allows committing if the tests are up to date)
- SuperTest (Used for e2e testing)
- Github Actions (To run the test pipeline whenever a PR/Push is made)
First, install the dependecies
npm run installRunning locally
npm run start:devRunning with Docker
npm run build:docker
npm run start:dockerTo ensure the proper functioning of the application, please follow these guidelines.
The games.log file is parsed when the /parser route is used.
Therefore, to get all the data on the other routes without any issues, first run the /parser route.
curl --location --request GET 'http://localhost:5001/parser'After that, you have the following alternatives:
To successfully use the route, you can use the cURL below:
curl --location --request GET 'http://localhost:5001/basic-stats' \
--header 'user: admin'If you want to test the story and try to get the route information as a user (it will return a 403 error):
curl --location --request GET 'http://localhost:5001/basic-stats' \
--header 'user: user' \
--header 'Content-Type: application/json' \To successfully use the route, you can use the cURL below:
curl --location --request POST 'http://localhost:5001/player-statistics' \
--header 'Content-Type: application/json' \
--data-raw '{
"playerName": "Mal"
}'There are 2 routes: the first one will get all the games, and the second one will get a specific game by its ID.
To use the second route, it's recommended to run the route that fetches all games first to get the specific ID of the game you want to view.
curl --location --request GET 'http://localhost:5001/games-statistics' \
--header 'user: admin'curl --location --request GET 'http://localhost:5001/games-statistics/8e5afa7d-f050-4f3f-92f0-afd2bd615e62' \
--header 'user: admin'This application has several test commands. Below is the list of commands:
npm test
npm run test:coverage
npm run test:watch
npm run test:ui
GitHub Actions has been added to this application to run tests automatically when a push is made or a PR is opened.