DEV Community

Discussion on: Simple ToDo GraphQL API in Ruby on Rails and MongoDB with Docker [PART 01]

 
sulmanweb profile image
Sulman Baig

Let me explain the purpose of this article in detail:

  • The first and far most important purpose is rails can do it as well
  • You can see many articles of creating rest API of todo with PostgreSQL but not like this.
  • rails is not only about short programming that you write one line and 10 files are created
  • rails best ergonomics is its design of OOP and restrictive architecture
  • I work in nodejs and cause of its openness one developer writes his way other developer writes his own way and when the third developer comes he gets confused what is written in code
  • Due to rails restrictiveness even when graphql laborious still when another user comes to code he will understand the flow.
  • I always prefer rails not because of shorthand but because of smooth coding.
  • Also, rails is hectic to install on windows which still is 70% of the world using that's why instead of simple rails new I devised docker methodology so that all world can work on rails.
  • This article is not for beginners but for intermediate developers that want to switch to node as its cool nowadays to give them a sense that rails is not dead and there is a lot more in rails than the fast development.
  • As far as mongo is concerned I agree with you but still, mongo is faster is not non-deep relationships, and also I used it as its being used as the norm in nodejs.
  • Documentation of rest API is a great issue if we use grape that even changes the development style of ruby or otherwise has to create yaml docs for front end which is a hectic job. But with graphql gem we keep in our normal ruby code and we get beautiful docs for frontend.
  • Also, the frontend can get whatever he/she needs from backend by making query instead of getting all non-relevant data and multiple calls to the server which is the main reason behind graphql creation.
  • Lastly, when working in an industry client sees that graphql and mongo is in these days so they order developers to use those then this article can be helpful.

Apart from those points, your point is valid that its hard to work like this in rails but believe me I have seen these situations where I needed such methodology. So, you can say its the article you may need not for your personal project but for some professional projects.

Hope this answers your confusions

Happy Coding!

Thread Thread
 
leastbad profile image
leastbad

Thanks for the detailed explanation! You sort of answered my question, I guess - your interest in Mongo and GraphQL seems primarily driven by what others are doing and what companies appear to be hiring for. This isn't a bad answer; maybe I was just hoping that you actually loved Mongo and GraphQL for some reason on a personal basis and you could tell me about it.

As you might guess, I'm not a big fan of doing what everyone else is doing just because, but I don't want to be a snob to the folks who think of development only as a job - they could be asked to use these tools because some CTO heard they were the next big thing.

I get (completely) why Mongo appeals to Node devs. Like I said, it's just a lot murkier for Rails devs.

I'm actually on Windows, but I'm using WSL2 so I can have an Ubuntu VM running all of my development concerns. It's amazing! Best of both worlds. Since I can only write code for one project at a time, I don't have a big need for Docker. Again, I'm not working on a team so I understand that I have a different case than you.

Just curious: have you checked out StimulusReflex yet? docs.stimulusreflex.com - it might be the coolest thing you see this week.

Thread Thread
 
sulmanweb profile image
Sulman Baig

Yes, I have been meaning to learn stimulus and stimulus reflex. Soon I will. Right now I know VueJS quite well and you will see VueJS implementation of this API soon.

Also, I love mongo and graphql but not more than the right tool for the right job. And I disagree with the notion that the right tool for the right job means switch to node from ruby as its right tool. Otherwise, I will still prefer graphql over rest but not mongo over postgres.

And maybe soon you will see me writing stimulus reflex tutorial as well 😊.

Happy Coding!

Thread Thread
 
leastbad profile image
leastbad

I honestly believe that Ruby and Rails both bring the world a little closer to happiness.