Skip to content

Instantly share code, notes, and snippets.

@afatihyavasi
Created June 14, 2021 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afatihyavasi/521e430dfb02a442015f873b3c405fb7 to your computer and use it in GitHub Desktop.
Save afatihyavasi/521e430dfb02a442015f873b3c405fb7 to your computer and use it in GitHub Desktop.
export async function getStaticProps({ params }) {
const response = await fetch(
`https://nextjs-blog-afatihyavasi.herokuapp.com/posts?slug=${params.slug}`
);
const data = await response.json();
const content = await serialize(data[0].content);
return {
props: {
data: data[0],
content,
},
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment