๐Ÿ“ฆ cloudflare / vinext

๐Ÿ“„ ssr.tsx ยท 25 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25import type { GetServerSidePropsResult } from "next";

interface SSRProps {
  message: string;
  timestamp: string;
}

export async function getServerSideProps(): Promise<GetServerSidePropsResult<SSRProps>> {
  return {
    props: {
      message: "Server-Side Rendered on Workers",
      timestamp: new Date().toISOString(),
    },
  };
}

export default function SSRPage({ message, timestamp }: SSRProps) {
  return (
    <>
      <h1>{message}</h1>
      <p>Generated at: {timestamp}</p>
    </>
  );
}