An open API service indexing awesome lists of open source software.

https://github.com/ronik-v/questions_web_api

Rest api for receiving questions for the quiz
https://github.com/ronik-v/questions_web_api

api fastapi fastapi-api postgresql rest-api

Last synced: 12 months ago
JSON representation

Rest api for receiving questions for the quiz

Awesome Lists containing this project

README

          

# questions_web_api

## Used technology
![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white)
![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge&logo=fastapi)

## Orm

SQLAlchemy - 2.0.4

# Setup




  • First, copy the repository


    Command:


    git clone https://github.com/ronik-v/questions_web_api.git



  • Compiling the project (docker-compose)


    Command:


    docker-compose build



  • Create database and use script for create Question model


    Database:


    CREATE DATABASE question_quiz;

    Run file: .\questions_web_api\data\database.py




  • Launch of the project


    Command:


    docker-compose up



  • Used libraries


    File with libraries versions


# Use example


Submitting question records to the database


from requests import post
url = 'http://localhost:9000/questions_api
_json = {'questions_num': 100}
result = post(url, json=_json)
print(result.json())

This post request returns the last question added to the database, filtering out duplicates and at the same time saving as many queries as were specified in the post request in the 'questions_num' parameter


# License


Apache License 2.0, details here