News for hackers. Stuff that matters.
Re:GraphQL Is a Trap? by lexx on Friday May 06, 2022 @10:28AM (#31285523)
I've found that this is a simple and effective way to handle relational data either in REST or Graphql. But imagine having to traverse trees, filter on data of different types and levels. Sort and filter on edges. I mean it can get pretty complex and I am not saying that REST would be easier on those complex cases.

In my opinion graphql and rest can both be super cute in simple everyday queries. But I am thinking that people are creating databases like postgres, mongodb, neo4j, etc, are doing exactly that. Trying to give us the power to query our data efficiently. Why not be able to expose directly the database and just add a layer for security, control, decorating and other stuff that would add value. Why rewrite databases?

Re:GraphQL Is a Trap? by travisd on Friday May 06, 2022 @10:49AM (#31285805)
There are products that do that! Hasura comes to mind.

But APIs can have different use cases. It’s usually considered bad to directly expose your table schema over GraphQL because it locks you in and makes it hard to change your data model over time. And not all API access is “get this data” and “set this data” — it can be difficult to express complex logic in just a database. And of course, some GraphQL APIs aren’t backed by a database - they’re backed by other services (a la the “backend for frontend” pattern).

I’m very pro choosing the simplest solution that works — but sometimes, the simplest solution does bring some complexity in exchange for other trade offs (like flexibility).

Re:GraphQL Is a Trap? by lexx on Friday May 06, 2022 @11:34AM (#31286383)
I agree with you. I am currently working on a project that need to give very sophisticated querying capabilities, so I'm kind of seeing everything from that prism.
Re:GraphQL Is a Trap? by agumonkey on Friday May 06, 2022 @10:58AM (#31285945)
css meets backend ?
Re:GraphQL Is a Trap? by lexx on Friday May 06, 2022 @12:47PM (#31287273)
Re:GraphQL Is a Trap? by agumonkey on Friday May 06, 2022 @01:46PM (#31287931)
that was unplanned