Next.js Discord

Discord Forum

I cant get SSR to work.

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
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

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
Answered by Ray
it should be localhost:3000/Ssr
View full answer

8 Replies

@Ray can you show a screenshot of the file structure you have?
Asiatic LionOP
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/Ssr
Answer
@Ray it should be `localhost:3000/Ssr`
Asiatic LionOP
Oh, its case sensitive? Cool.

Now i got another wonky one atleast 😄
Thanks so much!
❤️