Here is FastAPI RESTful API with MongoDB database for managing documents (.pdf, .doc, etc.). There is CRUD for documents with main doc file and covert image uploading. You can get test from current page or document at all. Also, you can request current page TTS audio, which will be your response )).
NOTE: .git root is project root;
Python 3.11;FastAPI;MongoDB;fastapi_authtools(my authentication library);gttstext-to-speach library;langdetectfor managing for managing pdf files;Pydantic 2.0;Motordatabase library;Docker;pytestin async mode for testing;flake8linter;
I use Python 3.11 as the project language.
The environment variables seem to be nice, but you can change it with ones you need
(.dev.env for developing, .docker.env for running application in Docker, .test.env for testing).
You can install application requirements with:
pip install -r requirements.txt
First install development requirements with:
pip install -r dev-requirements.txt
To run flake8 linter:
flake8
To run tests:
export MONGODB_VERSION=6.0-ubi8
docker run --name mongodb -d mongodb/mongodb-community-server:$MONGODB_VERSION
pytest
or write this for more information:
pytest -s -vv
You can run it using Docker. Run this command in the project root directory.
The server is default running at localhost:8000.
docker-compose up -d --build
For local running using uvicorn run:
export MONGODB_VERSION=6.0-ubi8
docker run --name mongodb -d mongodb/mongodb-community-server:$MONGODB_VERSION
uvicorn app.main:create_app --reload --port 8000