GraphQL vs REST: API Design Best Practices For Long-Running Operations | HackerNoon

پاکستان خبریں خبریں

GraphQL vs REST: API Design Best Practices For Long-Running Operations | HackerNoon
پاکستان تازہ ترین خبریں,پاکستان عنوانات
  • 📰 hackernoon
  • ⏱ Reading Time:
  • 54 sec. here
  • 2 min. at publisher
  • 📊 Quality Score:
  • News: 25%
  • Publisher: 51%

'GraphQL vs REST: API Design Best Practices For Long-Running Operations' api graphql

I've recently read an article where the author stated that GraphQL is "not appropriate for long-running operations". I'd like to show that GraphQL can very well be used for long-running operations.

From your own perspective, when you click a button on the web, how long until you get nervous when watching the progress bar? You will probably allow the service to run for a few seconds if you understand the complexity of the task. However, we're used to seeing some kind of progress after less than 5 seconds, at least when we're using a desktop browser.

However, as we've said earlier, this operation might take forever to complete and the user might cancel it. A better approach would be to design our API as an asynchronous API.Let's now turn the synchronous API into an asynchronous API. Instead of returning a response immediately, we should return a response with a unique identifier so that the client can poll the server for the result.The request has been received but not yet acted upon.

subscription { jobStatus { __typename ... on SuccessfulJob { id url sentiment } ... on QueuedJob { id url } ... on FailedJob { id url reason } ... on CancelledJob { id url time } } }Comparing REST and GraphQL for long-running operations

ہم نے اس خبر کا خلاصہ کیا ہے تاکہ آپ اسے جلدی سے پڑھ سکیں۔ اگر آپ خبر میں دلچسپی رکھتے ہیں تو آپ مکمل متن یہاں پڑھ سکتے ہیں۔ مزید پڑھ:

hackernoon /  🏆 532. in US

پاکستان تازہ ترین خبریں, پاکستان عنوانات



Render Time: 2025-08-28 04:18:02