Last active
May 30, 2020 11:59
-
-
Save talentlessguy/9f432a19a171f56e198dba91392ea4ee to your computer and use it in GitHub Desktop.
SSR example for react-link-previewer
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
Page.getInitialProps = async ({ query }) => { | |
try { | |
const res = await fetch(`https://og-service.herokuapp.com/?link=${query}`) | |
const json = await res.json() | |
return { json } | |
catch (e) { | |
return { error: e } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment