- Docker
- Docker Compose
- Python 3.8+
- FastAPi
- postgresSQL
- alembic
- pytest
- pip
- Git
- Clone the repository:
git clone https://github.com/YaraKoba/quiz-questions.git cd quiz-questions
- Create a
.env
file in the project root directory and add the necessary environment variables. You can use the.env.sample
file as a template.
-
Start the application and PostgreSQL database with Docker Compose:
docker-compose up -d
-
Run Alembic database migrations to set up the database schema:
docker-compose exec web alembic upgrade head
-
Check it. Now you can go to http://127.0.0.1/docs. You will see the automatic interactive API documentation
POST /questions/add-new
- this endpoint with content {"questions_num": integer} where0 < integer <= 100
. The service requests from the public APIhttps://jservice.io/api/random?count=1
the number of questions specified in the received request. If there is the same question in the database, the service will send repeated requests to the public API until a unique question for the quiz is received. return added questions
Run this comand:
pytest
tests files in app/tests