Should you build/ use a REST API or a GraphQL API? Can you only use GraphQL with React? Time for a detailed comparison!
Join the full “Node.js – The Complete Guide” course:
Join our Academind Community on Discord for free:
Exclusive discount also available for our “React.js – The Complete Guide” Course:
Check out all our other courses:
———-
Build a REST API from scratch with Node.js:
Build a GraphQL API from scratch with Node.js:
———-
• Go to and subscribe to our newsletter to stay updated and to get exclusive content & discounts
• Follow @maxedapps and @academind_real on Twitter
• Follow @academind_real on Instagram:
• Join our Facebook community on
See you in the videos!
———-
Academind is your source for online education in the areas of web development, frontend web development, backend web development, programming, coding and data science! No matter if you are looking for a tutorial, a course, a crash course, an introduction, an online tutorial or any related video, we try our best to offer you the content you are looking for. Our topics include Angular, React, Vue, Html, CSS, JavaScript, TypeScript, Redux, Nuxt.js, RxJs, Bootstrap, Laravel, Node.js, Progressive Web Apps (PWA), Ionic, React Native, Regular Expressions (RegEx), Stencil, Power BI, Amazon Web Services (AWS), Firebase or other topics, make sure to have a look at this channel or at academind.com to find the learning resource of your choice!
Nguồn: https://bomattw3.com/
Xem thêm bài viết khác: https://bomattw3.com/giai-tri/
Xem thêm Bài Viết:
- TẠO TỆP BÌNH SAI LƯỚI ĐỘ CAO (DPSURVEY)
- Top 5 pha combo tướng Raz của GTV XB xem mà thốn tận rốn
- Case Study GTV SEO Google Map – TẠO LẬP GOOGLE DRIVE & TRELLO
- ROBLOX PIGGY @ the MALL! Chapter 10 FGTeeV Multiplayer Escape (The Secret is Out)
- BÉ CHANH CẦM RAZ CÙNG PS MAN TÂM SỰ LÝ DO KHÔNG ĐÁNH GIẢI l BE CHANH GAMING
What about json:api?
Rest APIs can do everything that graphql does. Rest APIs can be programmed to accept the fields to be responded as parameters. Graphql adds more overhead and rest APIs are more extensible. No significant incentive to use graphql.
Why do you say the biggest advantage is that it send less data to the frontend when REST APIs can do the same, when you are building them you send what has to be sent and nothing more.
Thanks man! Fantastic work!
Another fantastic content from MAX 🙂 Thank you.
Great explanation, thanks Max!
Hello Max! Could you add a bonus section of GraphQL in your React Complete Guide course in Udemy? It would be wonderful! Thanks!
Max is always the best!
We can use FaunaDB which support GraphQL natively.
I'm taking your React course on Udemy right now, it's so great seeing you on so many platforms teaching and passing on your knowledge! I always find your tutorials helpful, easy to follow, and you convey concepts very succinctly.
Great video! Your videos are really helpful. thank you!
I wanna give this video more than one thumb
Thanks for video!
Actually you can retrieve fields of object you want using JSON REST API
https://jsonapi.org/format/#fetching-sparse-fieldsets
REST api also has spec for pagination, filtering and other things
The problem of one endpoint is that you cannot differentiate queries in balancers because they do not log the body of http requests
im running this example and everything looks good in eb however im getting a 500 error – .eba-2mppykm8.us-west-2.elasticbeanstalk.com/:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
At 5:32 — I'd probably stay away from saying GET requests don't have a body. Some good info at StackOverflow about this. This comment from 2015 notes that RFCs 7230-7237 removed the phrase "the message-body SHOULD be ignored when handling the request" from the HTTP spec: https://stackoverflow.com/questions/978061/#comment68112820_983458 . So initially not using the body from a GET request was a [strong] recommendation ("should"), but now even that recommendation has been removed.
As a practical example, ElasticSearch depends on GETs with bodies (https://stackoverflow.com/questions/978061/http-get-with-request-body#20349624).
If you need to do something covered by the verb GET and need a body to do it (perhaps there's a query that's routinely too long for a querystring), I believe we're getting much closer to that being standard practice.
No APIs.
There are a lot of things which are obvious in this explanation. Please in the future, go straight to the essential things.
I had a job interview before 2 weeks ago. And I was asked if i know what a GraphQL is, well i didn't knew cause so far i've used only Rest APIs and never had to dive in into the GraphQL, but now thanks to this 17 minutes video, I can understand the concepts behind the GraphQL and for what is used for. And I would like to thank you! All of your videos are very well structured and explained in a way that everyone can understand. I own almost all of your courses on Udemy and I learn a lot from you. Your courses are very well focused and cover lots of topics that most of the instructors are considering as "not important enough". So keep up the good work!
Another great video Max! Excellent work.
You say graphql is only work with POST method, maybe this is wrong. I see "GraphQL HTTP server should handle the HTTP GET and POST methods" in document of graphql. And can you create a video tutorial for uploading images with Graphql that has the same progress as Axios?
Schön erklärt, danke!
Great explanation! I've never written an API in GraphQL but now I'm inclined to do so to try it out. Thank you!
lets be honest most people will choose the most popular "proven" type for a new project even if it doesn't fit the problem because "we already know a lot about X….." so then they will twist X to fit any future requirements.
building bad and horrible REST APIs is easier but if you want to use HATEOAS then you need help is not as easy as you claim to be.
Really helpful. Thanks!
I suggest a drinking game on "API"
Hi there everyone! We here at Prisma are looking for a GraphQL Advocate to join our team in Berlin. I was hoping that someone in the GraphQL community, who is super enthusiastic about spreading the word about GraphQL, would be keen on joining us? Or perhaps you know someone who would?
If you do, give me a shout at rensburg@prisma.io. Would love to hear from you.
I wonder where the down vote come from?
Excellent explanation!
I think what you said in 6:17 might be wrong. Graphql does support GET method, it's not the most common but saying "Graphql only works with POST" is way off. So in case you want a graphql response to get cached you will have to use GET, since caching is not supported for POST method. Other then that I think the tutorial was pretty clear and helpful.
I hope you will build a serie on graphQL with Prisma2! I propose vue.js as frontend if you do 🙂
Interesting video but it does not answer the question.
Hey it's the guy from udemy
This was very useful. Now I understand where and when I would want to use GraphQL over REST. Thanks Max!
Thanks Sir.
Thank you for the tutorial sir. But i still couldn't understand whats the advantage of graphql.. It is not solving a problem
Do you think graphql was made to solve the problems of http/1.1 and with h/2 it has become redundant? Fundamentally, I feel seperation of anything is better than bulk executions
SOAP
wait so you are saying the only benefit of GraphQL is that you can specific which field do you want ? But that can also be achieved using rest apis ofcourse we need to add more logic in the backend but it totally possible only with few lines of code. So are you saying GraphQL is nothing but hype ?
404k subs atm, 1 mill not found
From a newbie stand point of view, GraphQL seems an evolution of XML Web service using Json and added some spice in the result. I know is not like the but it's looks like it. Great explanation, very clear and understandable.
With REST endpoint,function and attributes are parsed without needing to read the full body of the request. It can be done very fast and with no buffering. Then just stream the body to the correct handler.
GraphQL needs to read the full JSON body before deciding what to do, and which endpoints to send. which means huge buffering issues and a very complicated handling.
And all this for just a standard way to pass attributes?
Would be much better to just agree on a default http attribute spec for REST and call it a day.