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 to send all requests from the server-side, not the user’s client.
I have been working with and grokking
getInitialProps, but I am not confident that it is the full solution that I need because of this line in the
For the initial page load,
getInitialPropswill execute on the server only.
getInitialPropswill only be executed on the client when navigating to a different route via the Link component or using the routing APIs.
It seems that
getInitialProps is designed for the initial page load, and not for subsequent server-side data fetching.
How can I design my Next.JS app in such a way that all requests come from the server-side?
- It is OK that every request essentially results in an initial page load.
- It is OK for the user Client to talk back to the Node (Next.JS) server since it’s publicly-exposed. I am currently experimenting with wrapping Next.JS in an express server.
Ty in advance for any help