Recently for multiple projects during work and study I have been asked to define a web API that the back-end exposes and the front-end interface (single-page application-like) consumes.
All of these cases so far, I have looked at GraphQL and a couple of contenders, and in the end I decided every time to roll my own simple API library that uses a somewhat RESTful routing style for simple queries, returning simple JSON answers, with HTTP status codes indicating the difference between a success or a failure.
Every time I felt a bit insecure about this choice. The reason I decided not to use GraphQL is that it felt overkill for these projects, since GraphQL requires you to define schemas for all your objects, which seemed to me as an ‘expose your database to the world’ kind of construction which these projects were too far limited in scope for, as well as usually the content that actually gets exposed through an API being limited in the way how we want to return it to the front-end.
Still, not relying on tools such as GraphQL also feels like missing out, or like re-inventing the wheel. I hope some of you professional users of GraphQL and similar data-fetching tools can shed some light on this issue .