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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: How do I consume an API with the lowest JavaScript overhead?

1 点作者 dhruvkar超过 5 年前
How do I consume an API without making a full-blown JS SPA. I need the website to be light-weight and fast loading. However, all relevant content is going to come from an API. How do I do this in the most lightweight way possible?<p>I have very little JS experience. I mostly work with Python on the backend.

1 comment

aidos超过 5 年前
The API already exists? The very simplest thing to do in 2020 (assuming modern browsers) is to use fetch: <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Fetch_API&#x2F;Using_Fetch" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Fetch_API&#x2F;U...</a><p>Having said that, you probably still need to think a little about auth etc. Depends on what you&#x27;re doing. If it&#x27;s all internal then it&#x27;s fine but otherwise you need some notion of who the caller is and they need to send something with each request that&#x27;s checked on the python backend.
评论 #22066348 未加载