Last active
July 7, 2019 15:36
-
-
Save jacobedawson/84119efcb0d8e7979406f3178ed54759 to your computer and use it in GitHub Desktop.
Using the process.env variable in Next.js
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
import axios from "axios"; | |
Example.getInitialProps = async () => { | |
try { | |
const data = await axios.get(process.env.API); | |
// do something with data... | |
} catch (err) { | |
console.log(err): | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment