我有一个NextJS应用程序和DRF后端。在NextJS应用程序中,我有一个排行榜
页面,该页面从DRF后端摘下数据。但是,此排行榜
页面每天仅更新一次。因此,我想的是我希望我的Nextjs能够一次拉动API(也许在凌晨3点),并生成一个静态站点,因此该网站会很快加载(因为最多可容纳1000个访问者我需要网站快)。这可能吗?赦免我,我是NextJS的新手。
I have a NextJS application and a DRF backend. In the NextJS application, I have a leaderboard
page which pulls data from the DRF backend. However, this leaderboard
page is updated only once a day. So, what I'm thinking is I want my NextJS to be able to pull the API once (maybe at 3AM), and generate a static site, so the site would load quickly (as there can be up to 1000 visitors at once so I need the website to be fast). Is this possible? Pardon me I'm very new to NextJS.
发布评论
评论(1)
您可以尝试使用新功能“按需重新验证”尝试“增量静态再生”,但仍处于beta中!完成后,从您的排行榜页面上设置一个呼叫,以触发NextJS页面的新一代。
请参阅文档:
You can try "Incremental Static Regeneration" with the new feature "On Demand Revalidation" but it is still in beta! Set up a call from your leaderboard page when it is finished to trigger the new generation of the nextjs page.
See the documentation: https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration#on-demand-revalidation-beta