Closed kchojhu closed 3 years ago
You made my day because I was exactly looking for NextJS+NestJS solution.
The only suggestion I can make is to pre-fetch the data to highlight the SSR. I definitely got it to work using below code.
export async function getServerSideProps(context) { const {data} = await axios.get("http://localhost:3000/api/randomNumber"); return { props: { randomNumber: data, }, // will be passed to the page component as props } }` const Home = (props) => { return ( <p> Random Number: {props.randomNumber} </p> ) };
Happy the blog post has been helpful for you :)
Feel free to open a PR with your code, I'll happily merge!
You made my day because I was exactly looking for NextJS+NestJS solution.
The only suggestion I can make is to pre-fetch the data to highlight the SSR. I definitely got it to work using below code.