Just trying out the Flask(Python) and GraphQL bindings for the first time.
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. -(https://graphql.org/)
Graphene-Python is a library for building GraphQL APIs in Python easily, its main goal is to provide a simple but extendable API for making developers' lives easier. -(https://graphene-python.org/)
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. -(https://www.python.org/)
Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. -(https://flask.palletsprojects.com/en/1.1.x/)
-
Either fork the repository or directly clone the repository onto your local machine using
$git clone https://github.com/swapnanildutta/GraphQL-ed-Flask.git
-
Create a virtual environment and activate the environment.
$python3 -m venv venv $source venv/bin/activate
-
Install the dependencies from `requirements.txt
$pip3 install -r requirements.txt
-
Finally, run the
main.py
in root directory.$python3 main.py
-
Open the given link in the terminal with a
/graphql
after it, like http://127.0.0.1:5000/graphql.* Serving Flask app "books.app" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger PIN: 290-834-526
Here are some of the GraphQL queries for testing :