This repository contains a simple example of integrating GraphQL with FastAPI, a modern, fast (high-performance) web framework for building APIs with Python. The project demonstrates how to set up a GraphQL server using FastAPI and interact with it using GraphQL queries.
Features
- FastAPI: Utilizes FastAPI for building robust and high-performance APIs.
- GraphQL Integration: Demonstrates how to integrate GraphQL with FastAPI.
- Sample Schema: Provides a sample GraphQL schema with example queries and mutations.
- Interactive API Documentation: Utilizes Swagger UI and Redoc to generate interactive API documentation.
Requirements
- Python 3.7+
- pip
Installation
-
Clone the repository:
git clone https://github.com/sachnaror/GraphQL_FastAPI.git
-
Navigate to the project directory:
cd GraphQL_FastAPI -
Install the required dependencies:
pip install -r requirements.txt
Usage
-
Run the FastAPI server:
uvicorn main:app --reload
-
Access the GraphQL playground in your browser:
http://localhost:8000/graphql
Use the GraphQL playground to interact with the API by executing queries and mutations.
API Documentation
-
Swagger UI: Access the Swagger UI for interactive API documentation:
http://localhost:8000/docs
-
Redoc: Alternatively, access API documentation using Redoc:
http://localhost:8000/redoc
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.
License
This project is licensed under the MIT License. See the LICENSE file for details.