Code Monkey home page Code Monkey logo

graphene_cookbook_relay's Introduction

Graphene Cookbook Relay

Example Application with graphene_django and relay with reformatting structure. This repo is the walkthrough in the docs of graphene_django with relay. Its also have filtering capacities. There are some typos on docs and some deprecated codes. All these things fixed in this repo. So please follow the docs and this repo to make your code error free.

Setup Steps

  1. git clone https://github.com/kamranhossain/graphene_cookbook_relay.git
  2. cd graphene_cookbook
  3. virtualenv venv
  4. source venv/bin/activate
  5. pip install -Ur requirments/base.txt
  6. python manage.py makemigrations
  7. python manage.py migrate
  8. python manage.py createsuperuser
  9. python manage.py runserver
  10. Go to localhost:8000/graphql and type your first query!
query {
  allIngredients {
    edges {
      node {
        id,
        name
      }
    }
  }
}
  1. The above will return the names & IDs for all ingredients. But perhaps you want a specific ingredient:
query {
  # Graphene creates globally unique IDs for all objects.
  # You may need to copy this value from the results of the first query
  ingredient(id: "SW5ncmVkaWVudE5vZGU6MQ==") {
    name
  }
}
  1. You can also get each ingredient for each category:
query {
  allCategories {
    edges {
      node {
        name,
        ingredients {
          edges {
            node {
              name
            }
          }
        }
      }
    }
  }
}
  1. Or you can get only ‘meat’ ingredients containing the letter ‘e’:
query {
  # You can also use `category: "CATEGORY GLOBAL ID"`
  allIngredients(name_Icontains: "e", category_Name: "Meat") {
    edges {
      node {
        name
      }
    }
  }
}

graphene_cookbook_relay's People

Contributors

kamranhossain avatar bleedingpoem avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.