Example of an API GraphQL using Graphene, [Flask GraphQL](https:/ /github.com/graphql-python/flask-graphql) and Graphene-SQLAlchemy.
virtualenv --python python3 venv
source venv/bin/activate
pip install -U pip
pip install -r requirements-dev.txt
tox
docker-compose up #create and run web and db containers
docker-compose run --service-ports --name user_api_flask_web web --rm #allow application server to stop on breakpoints
docker-compose exec web bash #open the web container terminal
docker-compose exec db mysql #open mysql CLI in db container
Create a local .env file based on the .env.sample file.
python run.py #run local server on port 3000
The application uses Flask-Migrate to do database versioning.
First create the database for the development and test environments.
mysql -e "create database user_db;"
mysql -e "create database user_db_test;"
Right away:
python manage.py db migrate #create migration if there is a change in the database schema
python manage.py db upgrade #run database migrations
GET /api/healthcheck
GET /api/graphql
pytest
flake8 tests user_api