This project demonstrates how to build a GraphQL API using FastAPI and SQLAlchemy.
- Python 3.x installed on your machine
-
Clone the repository:
git clone https://github.com/rizwan1602/GraphQL-with-FastAPI.git -
Navigate to the project directory:
cd GraphQL-with-FastAPI -
Install dependencies:
pip install -r requirements.txt
To run the application, execute the following command: uvicorn main --reload
The GraphQL API will be available at http://localhost:8000/graphql.
Represents a user with id, name, and age fields.
Contains a resolver to retrieve a user by name and/or age.
Contains a resolver to add a new user with a name and age.
You can retrieve users by providing optional parameters name and age to the user query:
query {
user(name: "John", age: 30) {
id
name
age
}
}