How To Use GraphQL with Ruby on Rails - Part 1 - Backend

Sdílet
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

Komentáře • 37

  • @Webcrunch
    @Webcrunch  Před 4 lety +13

    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!

  • @TyrellJoanna
    @TyrellJoanna Před 4 lety +10

    Best Ruby on Rails Videos ever!

  • @tylersustare
    @tylersustare Před 3 lety +2

    This was a freaking lifesaver to get GQL RoR working still a year later.

  • @tylereikenberg9651
    @tylereikenberg9651 Před 4 lety +3

    This video is awesome and I'm really glad that you walk through your errors and mistakes rather than editing them out.

  • @GreenspudTrades
    @GreenspudTrades Před 4 lety +3

    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!

  • @mitulgautam
    @mitulgautam Před 2 lety +1

    Beautifully explained! Learned it in just one lesson.

  • @mattstopa9436
    @mattstopa9436 Před 3 lety +2

    I'm too lazy to look this up myself. Thanks for doing this!

  • @kkulikov
    @kkulikov Před 4 lety +1

    Thank you! It was really easy to watch and learn! Still interesting mutations for update and delete.

  • @LK-lm1sx
    @LK-lm1sx Před 4 lety

    Great work! LOVE it! Thank you!! I cannot wait for Part 2! :)

  • @ckjolhede
    @ckjolhede Před rokem

    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.

  • @brunomrlima
    @brunomrlima Před 4 lety

    Thank you for this video. Please keep doing content like this!!

  • @GlobalHamster
    @GlobalHamster Před 4 lety

    Nice video. Waiting for second part

  • @brandonfonseca9279
    @brandonfonseca9279 Před 2 lety +1

    Amazing video, thank you so much!!

  • @medhatalhaddad7237
    @medhatalhaddad7237 Před 2 lety

    Great tutorial, thanks:)

  • @tamayeseruysal7405
    @tamayeseruysal7405 Před 4 lety

    The best like always

  • @danilnovikov8372
    @danilnovikov8372 Před 2 lety +1

    Thanks !

  • @JorgeDominguezWehbe
    @JorgeDominguezWehbe Před 4 lety

    Nice one!

  • @zelixir3876
    @zelixir3876 Před 4 lety +4

    Hi Andy, would you mind sharing your terminal and vscode theme and config? Looks solid!

  • @juxiaerju721
    @juxiaerju721 Před 4 lety

    Nice!

  • @ChrysusTV
    @ChrysusTV Před 2 lety

    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.

  • @taylorcovington3314
    @taylorcovington3314 Před 4 lety +1

    Hey Andy, does your Hello Rails course teach React on Rails? Do you use GraphQL as well?

    • @Webcrunch
      @Webcrunch  Před 4 lety

      Niether actually. It's more foundational Rails oriented, making use of the framework in it's already awesome vanilla state.

  • @joshuagalit6936
    @joshuagalit6936 Před rokem

    What did you just put bracket in if statement? 29:53

  • @kensanchez2064
    @kensanchez2064 Před 2 lety

    You don't need the Types::PostType since it's already on the Types Module. Having PostType can do the trick.

  • @nicobobb
    @nicobobb Před 4 lety +1

    Can you use "rails devise authentication" with Graphql?

  • @ngt91
    @ngt91 Před 4 lety

    Can you please explain more about those `null: false` inside query_type.rb

    • @Webcrunch
      @Webcrunch  Před 4 lety +1

      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.

  • @deven9229
    @deven9229 Před 4 lety

    Andy, please do a video on pundit gem.

  • @adrianadipietro5152
    @adrianadipietro5152 Před 2 lety

    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.

  • @peteryun8929
    @peteryun8929 Před 4 lety

    Is part 2 out? It seems nobody ever talks about how to work with the response.

    • @Webcrunch
      @Webcrunch  Před 4 lety

      Right here czcams.com/video/TOq86ozyHIA/video.html

  • @marksahlgreen9584
    @marksahlgreen9584 Před 4 lety

    Amazing tutorial, but could you get rid of the letterboxing in your videos?

    • @Webcrunch
      @Webcrunch  Před 4 lety

      Letterboxing?

    • @marksahlgreen9584
      @marksahlgreen9584 Před 4 lety +1

      Yea. Most people watch in 16:9 so with your format there are big Black bars on either side of the frame :)