Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL with FastAPI.

This project demonstrates how to build a GraphQL API using FastAPI and SQLAlchemy.

Getting Started

Prerequisites

  • Python 3.x installed on your machine

Installation

  1. Clone the repository:

    git clone https://github.com/rizwan1602/GraphQL-with-FastAPI.git
    
  2. Navigate to the project directory:

    cd GraphQL-with-FastAPI
    
  3. Install dependencies:

    pip install -r requirements.txt
    

Running the Application

To run the application, execute the following command: uvicorn main --reload

The GraphQL API will be available at http://localhost:8000/graphql.

GraphQL Schema

UserType

Represents a user with id, name, and age fields.

Query

Contains a resolver to retrieve a user by name and/or age.

Mutation

Contains a resolver to add a new user with a name and age.

Usage

Retrieving Users

You can retrieve users by providing optional parameters name and age to the user query:

query {
  user(name: "John", age: 30) {
    id
    name
    age
  }
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages