How To Use GraphQL with Ruby on Rails - Part 1 - Backend
Vložit
- čas přidán 12. 06. 2024
- Hi, My name is Andy Leverenz and I work as a product designer and developer. For fun, I design, code, and write. Check out my blog called Web-Crunch web-crunch.com where I publish design and development tutorials with the occasional vlog.
====================
GraphQL is a query language for APIs. The query language itself is universal and not tied to any frontend or backend technology. This characteristic makes it a great choice for many frameworks or patterns you or your company might follow.
Today, I'm going to build a basic API using GraphQL with Ruby on Rails. This will only cover backend/api concepts. In the future, I plan to add an additional tutorial on implementing a front-end around the same concepts. Look for that soon!
Download the source code: github.com/justalever/graphql...
💻 Previously published at: web-crunch.com/how-to-use-gra...
====================
📰 One-Click Subscribe:
czcams.com/users/webcrunc...
💎🛤 NEW COURSE: HELLO RAILS
hellorails.io
💻 Check out the blog:
web-crunch.com
🦄 Check out my personal site:
justalever.com
🚀 Links:
Weekly Newsletter: web-crunch.com/subscribe
Twitter: / webcrunchblog
Twitter(Personal Account): / justalever
Facebook: / webcrunchblog
Dribbble: dribbble.com/justalever
Github: github.com/justalever
📘Check out my book on UX Design:
"LUXD: Learn User Experience Design"
web-crunch.com/books/luxd
📙 Check out my FREE book on Tumblr Theming:
"Pro Tumblr Theming"
web-crunch.com/books/ptt
💯 Need awesome web hosting? Check out cloudways. They allow me to use a variety of hosting providers and build apps with ease:
bit.ly/webcrunchhosting
🌊 Need more advanced hosting for Rails, PHP, Node, or other projects? Digital Ocean has you covered.
m.do.co/c/ee243ee15648
💎 Ruby on Rails devs, Try HatchBox.io. You'll save upwards of 50% compared to Heroku. I use it and love it!
hatchbox.io/?via=andy
☕️ Keep me awake. Buy me a coffee
www.buymeacoffee.com/webcrunch
Hey all! Sorry for some audio blips here and there on this one. I had some technical difficulties with another computer I needed to use. Part 2 coming soon!
Best Ruby on Rails Videos ever!
This was a freaking lifesaver to get GQL RoR working still a year later.
This video is awesome and I'm really glad that you walk through your errors and mistakes rather than editing them out.
This tutorial was excellent. Gave me a big boost in my understanding of GQL in Ruby since the official docs for that gem are so lacking in quality examples!
Beautifully explained! Learned it in just one lesson.
I'm too lazy to look this up myself. Thanks for doing this!
Thank you! It was really easy to watch and learn! Still interesting mutations for update and delete.
Great work! LOVE it! Thank you!! I cannot wait for Part 2! :)
Great instruction. Clearly spoken and demonstrated. And everytime I think I'm learning something totally new, I realize its been around for years. Haha, new to me! Wonder what's changed since this was made.
Thank you for this video. Please keep doing content like this!!
Nice video. Waiting for second part
Amazing video, thank you so much!!
Great tutorial, thanks:)
The best like always
Thanks !
Nice one!
Hi Andy, would you mind sharing your terminal and vscode theme and config? Looks solid!
Nice!
This was so useful. Looking into switching from JSON:API to GraphQL, but the documentation is overwhelming. Never enjoy when something is like, "look at all these incredible things you could do! ...but we're not going to teach you the basics." Not sure how I feel about building out custom queries yet; with JSON:API of course you can just inject every major request types automatically into each controller. On the other hand, it seems like with GraphQL you can achieve much finer control more easily, and I think protecting very specific queries via Pundit or something will be much easier than trying to protect an entire endpoint that accepts any data.
Hey Andy, does your Hello Rails course teach React on Rails? Do you use GraphQL as well?
Niether actually. It's more foundational Rails oriented, making use of the framework in it's already awesome vanilla state.
What did you just put bracket in if statement? 29:53
You don't need the Types::PostType since it's already on the Types Module. Having PostType can do the trick.
Can you use "rails devise authentication" with Graphql?
I'll give it a shot!
Can you please explain more about those `null: false` inside query_type.rb
null: false essentially means the field is required before the query can be performed. and ID field , for example, is pretty necessary to return data.
Andy, please do a video on pundit gem.
Hi! Great video so far.
What do I do if at 14:53 I do not have the sprockets framework -- so I have nothing to uncomment. I am currently receiving "ActionDispatch::Request::Session::DisabledSessionError in GraphiQL::Rails::Editors#show" error in the browser at localhost:3000/graphiql.
Hey wanted to ask if you solved it? and how?
Is part 2 out? It seems nobody ever talks about how to work with the response.
Right here czcams.com/video/TOq86ozyHIA/video.html
Amazing tutorial, but could you get rid of the letterboxing in your videos?
Letterboxing?
Yea. Most people watch in 16:9 so with your format there are big Black bars on either side of the frame :)