nest-next
nest-next copied to clipboard
Are getStaticProps and getServerSideProps supported?
In example I see that you use getInitialProps function. But in the official doc there is an info that it's better to use getStaticProps and getServerSideProps.
I downloaded your example, installed last version of next, replaced getInitialProps -> getStaticProps and started an app.
export const getStaticProps = async (arg) => {
// arg is {}
};
What I see? The argument is empty object.
After that I opened this official doc (https://nextjs.org/docs/advanced-features/custom-server) and found the next info:
A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.
If I am right, it's exactly what this library do - replace next's server with custom one (from nest js). So, am I right that if I choose this library, then there will be no ways to cache generated pages and I will have to render it on every request?
Or maybe you have some ideas and in the future versions you are going to implement it?
Does somebody has any minds about this?
getServerSideProps
works and can replace the getInitialProps
call ; however, I am unsure if getStaticProps
will work. I would be curious to see if it works with the beta passthrough feature.
@kyle-mccarthy How does getServerSideProps work? In ctx.query I am getting an empty object and my nest controller is not being called
It is worth clarifying that everything works fine with server rendering. This problem occurs when switching between pages and requests like /_next/data/development/Main.json