TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: GraphQL or REST – What is THE way to implement an API in 2020?

8 点作者 dhruvkar超过 5 年前

3 条评论

mmerlin超过 5 年前
IMO this depends who is the target user of the API.<p>If you are building an API for yourself or your company (for example, you are building the backend API for a Vue.js front end app to consume) then GraphQL is a very fine choice for reasons like ease&#x2F;speed of adding new features to your API, concise single-fetches by the client consumer, and even the possibility of client with reactive subscription to a GraphQL query.<p>On the other hand, if you are publishing an API with the intention of enabling mass consumption by a large number of external customers, then begin by offering them a REST API for it’s ubiquity and familiarity. Once the REST API is built then you consider offering a GraphQL API.<p>It would be interesting to aggregate statistics from companies who offer <i>both</i> REST and GraphQL API’s and compare the popularity &#x2F; adoption rates of each option, by their customers.
Nextgrid超过 5 年前
REST. It&#x27;s been around for a long time, is well-understood and simple.<p>Don&#x27;t introduce the extra complexity of GraphQL unless its advantages (which heavily depend on your use case) outweigh the drawbacks (the extra complexity is a big one).
shams93超过 5 年前
It depends like graphql requires a pretty heavy client library while rest can work with vanilla Js fetch with no client library