I cant get SSR to work.
Answered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
I have declared a file called Ssr.tsx (in the pages directory i created under the app folder)
within this file i have this code
and when i go to localhost/ssr i get 404.
Shouldnt this be the most basic example one can make? No clue as to why its not working
within this file i have this code
import { InferGetServerSidePropsType } from 'next';
function Page({
data,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
return (
<div>
<h1>Server Side Rendered page</h1>
<p>{data}</p>
</div>
);
}
export default Page;
export async function getServerSideProps() {
const data = 'This is a static string';
return {
props: { data },
};
} and when i go to localhost/ssr i get 404.
Shouldnt this be the most basic example one can make? No clue as to why its not working
8 Replies
Absolutely. I just created this to tinker a bit, couldn't get the hang of it in my main project if my life depended on it
it should be
localhost:3000/SsrAnswer
@Ray it should be `localhost:3000/Ssr`
Asiatic LionOP
Oh, its case sensitive? Cool.
Now i got another wonky one atleast 😄
Now i got another wonky one atleast 😄
Thanks so much!
â¤ï¸