Next.JS: How to make ALL requests server-side

后端 未结 3 1682
星月不相逢
星月不相逢 2021-02-02 02:45

I am building a Next.JS app that will be getting data from a Python API and an Postgres Database.

Normally this would be simple, except requirements are such that I need

3条回答
  •  独厮守ぢ
    2021-02-02 03:30

    I thinks this is done simply with getServerSideProps() Official Docs. It's as simple as it says really: "If you export an async function called getServerSideProps from a page, Next.js will pre-render this page on each request using the data returned by getServerSideProps"

提交回复
热议问题