Skip to content

Instantly share code, notes, and snippets.

@jacobedawson
Last active July 7, 2019 15:36
Show Gist options
  • Save jacobedawson/84119efcb0d8e7979406f3178ed54759 to your computer and use it in GitHub Desktop.
Save jacobedawson/84119efcb0d8e7979406f3178ed54759 to your computer and use it in GitHub Desktop.
Using the process.env variable in Next.js
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