←back to thread

153 points michaelanckaert | 2 comments | | HN request time: 0.003s | source
Show context
tannhaeuser ◴[] No.23486066[source]
Tbh I'd expected a little better than framing this question in a "REST vs GraphQL" discussion coming from sourcehut.org. If you control your backend, you can aggregate whatever payloads you please into a single HTTP response, and don't have to subscribe to a (naive) "RESTful" way where you have network roundtrips for every single "resource", a practice criticized by Roy Fielding (who coined the term "REST") himself and rooted in a mindset I'd call based more on cultural beliefs rather than engineering. That said, a recent discussion [1] convinced me there are practical benefits in using GraphQL if you're working with "modern" SPA frameworks, and your backend team can't always deliver the ever-changing interfaces you need so you're using a backend-for-fronted (an extra fronted-facing backend that wraps your actual backend) approach anyway, though it could be argued that organizational issues play a larger role here.

[1]: https://news.ycombinator.com/item?id=23119810

replies(2): >>23486172 #>>23486241 #
jamil7 ◴[] No.23486172[source]
I like GraphQL but if you're just serving a single SPA I wonder about all this busy work we still have to do. Why haven't we gone a step further and just abstracted all the networking and serialisation steps away and our models are synced for us in the background. Maybe the apollo team is heading in this direction but their offline story isn't great yet.

Edit: I remember now that the Apollo team is made up of members of the former Meteor team which worked in a similar way using a client side database.

replies(1): >>23486178 #
searchableguy ◴[] No.23486178[source]
You can use rxdb for replication and offline support.
replies(1): >>23486187 #
jamil7 ◴[] No.23486187[source]
Yeah good point, WatermelonDB, rxdb and pouchdb all fit this model. This to me feels like the future for web and mobile.
replies(1): >>23486228 #
1. searchableguy ◴[] No.23486228{3}[source]
Hopefully not. In an ideal world, this would be the responsibility of the browser given the widespread web apps.
replies(1): >>23486279 #
2. jamil7 ◴[] No.23486279[source]
I don't follow, how do you mean?