API source code. Written on python using FastAPI, SQLITE, SQLAlchemy, Alembic, PyTest, JWT
- Python 3.10
- Python PIP (https://pip.pypa.io/en/stable/installation/)
- Python venv module (https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)
- Clone code from the repository to the local machine
$ git clone [email protected]:Slavian2015/FastAPIPostAuth.git path_on_locahost
- CD into the project folder
- Create python virtual environment
$ python3 -m venv ./venv
- Activate virtual environment
$ source ./venv/bin/activate
- Install application dependencies
$ pip install -r requirements.txt
- Copy .env.dist file to the .env file
$ cp .env.dist .env
- Configure .env file
- AUTH_SECRET - Random string that will be used as a key for the hashing
- NUMBER_OF_USERS - Random integer that will be used in test db users creation
- MAX_POSTS_PER_USER - Random integer that will be used in test db post creation
- MAX_LIKES_PER_USER - Random integer that will be used in test db likes creation
- Copy .env.dist file to the .env file
$ alembic upgrade head
- Unit test suite
$ python3 -m pytest tests/unit
- Functional test suite
$ python3 -m pytest tests/functional
All tests should pass successfully to consider setup is finished and works
- Start uvicorn service
$ uvicorn src.api.application:api --host=localhost --port=8080
- Run python bot
$ python3 demo_db/bot.py