Is it a good idea to mix REST and GraphQL in my project?

0
17
Asked By CuriousCoder92 On

I'm considering using GraphQL primarily for data fetching and REST for POST requests and updates in my project. The main reasons are that GraphQL allows for fetching exactly the fields we need and reduces over-fetching, which would benefit complex UI queries. On the other hand, REST is simpler for some endpoints, especially for handling external API integrations since it requires less boilerplate for mutations. I believe that using both could help leverage the strengths of each technology. However, I'm concerned about the complexity of managing both in the codebase.

2 Answers

Answered By DataDynamo88 On

GraphQL theoretically helps reduce the number of endpoints you have to manage by allowing more flexible queries, but it doesn’t fix over-fetching as commonly believed. Instead, it can sometimes lead to more database calls since you might fetch too much data only to filter it later. For smaller projects, you might not need it—stick with what works for you!

Answered By TechSavvy101 On

Mixing REST and GraphQL can be tricky. If GraphQL solves any problem you see with REST, then maybe you should just stick with one or the other. Maintaining both might complicate things more than necessary. If you want to do both, I’d suggest being careful about how they interact—having a hybrid setup can lead to confusion down the road.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.