This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Fix ssr-caching example. (vercel#26540)
Closes vercel#12019 with a better example of proper SSR caching.
- Loading branch information
Showing
5 changed files
with
39 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Home() { | ||
export default function Index({ time }) { | ||
return ( | ||
<ul> | ||
<li> | ||
<Link href="/blog?id=first" as="/blog/first"> | ||
<a>My first blog post</a> | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog?id=second" as="/blog/second"> | ||
<a>My second blog post</a> | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog?id=last" as="/blog/last"> | ||
<a>My last blog post</a> | ||
</Link> | ||
</li> | ||
</ul> | ||
<main> | ||
<h1>SSR Caching with Next.js</h1> | ||
<time dateTime={time}>{time}</time> | ||
</main> | ||
) | ||
} | ||
|
||
export async function getServerSideProps({ req, res }) { | ||
res.setHeader( | ||
'Cache-Control', | ||
'public, s-maxage=10, stale-while-revalidate=59' | ||
) | ||
|
||
return { | ||
props: { | ||
time: new Date().toISOString(), | ||
}, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.