Skip to content

Latest commit

 

History

History
108 lines (90 loc) · 1.19 KB

README.md

File metadata and controls

108 lines (90 loc) · 1.19 KB

django graphql with graphene

This application can be a template for bigger graphql based application for django

how to install

Clone or download this repository

Run following commands:

pip install -R requirements.txt

python manage.py migrate

python manage.py runserver

Go to the address which came output from above command. eg. http://localhost:8000/graphql/

Then you can run the following graphql:

query getActors {
  actors {
    id
    name
  }
}
query getMovie {
  movie(id: 1) {
    id
    title
    actors {
      id
      name
    }
  }
}
mutation createMovie {
  createMovie(input: {
    title: "Cast Away",
    actors: [
      {
        id: 3
      }
    ]
    year: 1999
  }) {
    ok
    movie{
      id
      title
      actors {
        id
        name
      }
      year
    }
  }
}
mutation updateMovie {
  updateMovie(id: 2, input: {
    title: "Cast Away",
    actors: [
      {
        id: 3
      }
    ]
    year: 2000
  }) {
    ok
    movie{
      id
      title
      actors {
        id
        name
      }
      year
    }
  }
}
query getMovies {
  movies{
    id
    title
    actors {
      id
      name
    }
  }
}