Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building a GraphQL API with DJango
Search
James Muranga
August 13, 2017
Programming
1
110
Building a GraphQL API with DJango
Slides from the Tutorial at DjangoCon 2017
James Muranga
August 13, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
160
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
170
CSC307 Lecture 15
javiergs
PRO
0
270
SourceGeneratorのマーカー属性問題について
htkym
0
220
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
150
OTP を自動で入力する裏技
megabitsenmzq
0
130
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
290
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
530
Ruby and LLM Ecosystem 2nd
koic
1
1.3k
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
140
Featured
See All Featured
HDC tutorial
michielstock
1
580
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Designing for humans not robots
tammielis
254
26k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
690
It's Worth the Effort
3n
188
29k
Building the Perfect Custom Keyboard
takai
2
720
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Done Done
chrislema
186
16k
The Curious Case for Waylosing
cassininazir
0
280
Visualization
eitanlees
150
17k
How to make the Groovebox
asonas
2
2k
Building Applications with DynamoDB
mza
96
7k
Transcript
Building A GraphQL API Using Django James Muranga
Developer at ThoughtWorks @murangajames
[email protected]
PLEASE SHARE ANY FEEDBACK YOU
HAVE FOR ME
Building A GraphQL API Using Django
AGENDA •What is GraphQL •Why? •Graphene ? •Django App
SETUP •Python •An Editor (VSCode, Atom, PyCharm etc) •Starter project
http://bit.ly/2fCLUGp FEEL FREE TO INTERRUPT AND ASK QUESTIONS
GraphQL A Query Language for APIs
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Why GraphQL ?
•REST •SOAP •JSON RPC •… What else is there ?
RESTFUL API FOR “SOME APP” •List of Users •Each User
has notes •Each Notes has revisions
GET https://api.someapp.com/api/v1/users [ { "id": "2016", "name": "The one who
cant be named", "notes": [ { "id": "2015", "content": "The friend", "revision": "1", "size": 108, "topics": [ "octocat", "atom", "electron", "API" ], "has_issues": true, "has_wiki": true, "has_pages": false, "has_downloads": true, "pushed_at": "2011-01-26T19:06:43Z", "created_at": "2011-01-26T19:01:12Z", "updated_at": "2011-01-26T19:14:43Z", "permissions": { "admin": false, "push": false, "pull": true }, "subscribers_count": 42, "network_count": 0 } ] }
REQUESTS ARE HUGE !!!
GET https://api.someapp.com/api/v2/users [ { "id": "2016", "name": "The one who
cant be named", "notes": "https://api.app.com/api/users/2016/notes" } ] GET https://api.someapp.com/api/v2/users/2016/notes [ { "id": "2015", "content": "The friend", "revision": "1", "size": 108, "topics": [ "octocat",
REQUESTS ARE MANY !!!
Request Response
Graphene an example implementation in Python
SCHEMA QUERY MUTATION
None
None
None
SCHEMA QUERY MUTATION
SCHEMA QUERY MUTATION
None
GRAPHENE DEMO http://bit.ly/2fCLUGp
Polls App • Setup • Walkthrough the App • Add
Schema • Browse GraphiQL • Write Tests • Add mutation • Write more tests • Handle Users • Questions
SETUP •Python •An Editor (VSCode, Atom, PyCharm etc) •Starter project
http://bit.ly/2fCLUGp FEEL FREE TO INTERRUPT AND ASK QUESTIONS
Debug GRAPHENE = { 'SCHEMA': 'polls.schema.schema', 'MIDDLEWARE': [ 'graphene_django.debug.DjangoDebugMiddleware', ]
} debug = graphene.Field(DjangoDebug,name='__debug')
Schema ./manage.py graphql_schema —schema out.json
Users
http://graphene-python.org/ http://graphql.org/
GraphQL is just another tool