Skip to content

Commit

Permalink
SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
hopefourie-nyt committed Apr 20, 2022
1 parent 8f59bbe commit f05de05
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 249 deletions.
245 changes: 7 additions & 238 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@types/node": "^17.0.23",
"@types/react": "^18.0.3",
"@types/react": "^18.0.1",
"typescript": "^4.6.3"
}
}
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function Home({ allPostsData }) {
);
}

export async function getStaticProps() {
export async function getServerSideProps() {
const allPostsData = getSortedPostsData();
return {
props: {
Expand Down
10 changes: 1 addition & 9 deletions pages/posts/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ export default function Post({ postData }) {
)
}

export async function getStaticPaths() {
const paths = getAllPostIds()
return {
paths,
fallback: false
}
}

export async function getStaticProps({ params }) {
export async function getServerSideProps({ params }) {
const postData = await getPostData(params.id)
return {
props: {
Expand Down

0 comments on commit f05de05

Please sign in to comment.