DEV Community

Discussion on: Does GraphQL replace REST API ?

Collapse
 
valeriavg profile image
Valeria

GraphQL has a lot of drawbacks in comparison to REST ranging from bloated payload to security and scalability concerns. But if one uses GraphQL on the edge of infrastructure, e.g. to connect RESTful microservices, it truly shines. Hence those two are not rivals, they compliment one another quite nicely ☺️

Collapse
 
pratham10 profile image
Pratham

100% agreed!

Collapse
 
rerodrigues profile image
Renato Rodrigues

Agreed! They totally complete each other. My approach is to write every specific API using REST and then connect them using GraphQL, also do all complicated and process hungry calculations on the GraphQL side, a k.a use GraphQL as a BFF (backend for frontend). It has worked nicely in my last two jobs

Collapse
 
hintofsarcasm profile image
Nathan • Edited

Well said. It's not an either/or situation, a lot of - especially more enterprise usage - implementations would not benefit from a purely GraphQL data acquisition model.

Collapse
 
curiousdev profile image
CuriousDev

Maybe I need some experience with GraphQL to better understand the comparison, but I would agree on that it cannot or should not replace REST APIs. These are just two different options and surely not the only ones!
Also you will not always have the possibility to decide which one you can use, because if you are consuming endpoints (which are not developed by yourself), you will have to choose from what you get.

Collapse
 
jensneuse profile image
Jens Neuse

You actually don't have and should not choose between GraphQL and REST. They solve different problems and work best if you combine them. I'm the creator of WunderGraph, a framework that does exactly this, combine the strengths of both. We leverage the flexibility and type-safety of GraphQL and the performance and security aspects of REST. It's built in a way that feels like you're using "just" GraphQL with all it's bells and whistles but you're actually creating REST apis behind the scene. I'd love to hear your feedback. Here's a link: wundergraph.com