- Create virtualenv
- Goto the project root directory and run
pip install -r requirements.txt
- run
python manage.py migrate
- Visit
http://127.0.0.1:8000/graphql/
and start playing with GraphQL!
- Get list of poll questions
query {
questions {
id,
questionText,
pubDate
}
}
- Get list of poll questions with choice(s)
query {
questions {
id,
questionText,
pubDate,
choices {
id,
choiceText
}
}
}
- Create a poll question
mutation {
createQuestion(
questionText: "What is GraphQL?",
pubDate: "2019-01-01T00:00:00"
) {
question {
id,
questionText,
pubDate
}
}
}
- Update a specific poll question
mutation {
updateQuestion(
id: 1,
questionText: "My poll question"
) {
question {
id,
questionText,
pubDate
}
}
}
- Delete a specific poll question
mutation {
deleteQuestion(
id: 1,
) {
message
}
}