Closed frankcollins3 closed 1 year ago
forgot about restarting the server that'll probably do it [3:00am]
touch env.local
client: 👎 process.env.local
[3:17pm]
will look into next&&env config later on.
I wonder if getServerSideProps works but I hear there's a new preferred way to do data handling prebuild in next.js [3:19pm]
next docs: https://nextjs.org/docs/api-reference/next.config.js/environment-variables
I'm still kind of confused why you don't see those endpoints anywhere on process.env tv dinner && dvd dinner
do pop up from the next.config
I also initially put a new module.exports { } beneath the next config export and reset it to be keys within the export obj [3:38pm]
[3:44pm]
nvm forgot to restart the server again this is working. [3:46pm]
problem. the utility func doesn't have access to process.env
updated utility function to take parameter
import Axios from 'axios'
const pokeapiURL = `https://pokeapi.co/api/v2/pokemon?limit=300`
// const envURL = process.env.ALLpokemonURL
export default async function APIpokemonALL (url:any|null) {
let predata = await Axios.get(url || pokeapiURL)
console.log('predata')
console.log(predata)
return {predata: predata, data: predata.data.results}
}
[3:51pm]
success. process.env retrieved and passes as a valid string when exported from: next.config.js to be available to every: ----------------> pages/
[3:59pm]
.env:![Screen Shot 2023-03-13 at 2 12 36 PM](https://user-images.githubusercontent.com/73137934/224792099-c33a531d-df96-4a1f-819a-62fbb2d301a5.png)
dependencies:![Screen Shot 2023-03-13 at 3 06 58 PM](https://user-images.githubusercontent.com/73137934/224804474-b9bea7db-890b-46e4-a587-1e1c4214c7d3.png)
browser/devtools from console.log()![Screen Shot 2023-03-13 at 2 14 50 PM](https://user-images.githubusercontent.com/73137934/224804047-9ac6cb4d-8257-47c6-9cbd-190df592660d.png)