Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> In reality, you'd more likely have an endpoint like `/videos/user/12` or `/users/12/videos`

Sure and then you do the same with images and friends. And all of those have tags. Friends are also users so they also have videos and images... which have tags. Friends can also have friends of course... it can even be circular!

I wanted to keep my example simple, but here you go...

> Hmm, so I think you're saying that there would still be separate queries, but you're "batching" them, such that client sends multiple queries simultaneously to the backend

Sorry, I used the same term for two different things. Nothing happens in parallel. Frontend sends one request (not one query...) to the backend which contains two graphql queries (one of them a nested query). It is all one http request and one response. No batching here, you can send this request using curl or postman.

HTTP/2 does not help here, because the second query is dependent on the first one (hence a subquery). Because you need to know the video ids first. Sometimes HTTP/2 helps, but not in this case.

> I'm not entirely sure if you're kidding, but I assure you I didn't edit my post.

Not kidding at all - maybe I mixed it up?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: