Closed frankcollins3 closed 1 year ago
👎 axios.get('isItRaining') got excited to find solution without chat and this doesn't work surprisingly. It defaults to calling the URL from the frontend url which is (in dev mode) currently :host/3000 [6:00pm]
changed to pokeAPI and removed changeOrigin just see plain API fetch but with proxy: "/isItRaining'"
app.use('/isItRaining', createProxyMiddleware({
target: 'http://pokeapi.co/api/v2/pokemon',
// changeOrigin: true,
// pathRewrite: {
// '^/isItRaining': 'http://dataservice.accuweather.com/locations/v1/CG0C6JlnXhBUOi4R9JlJILWZGyBP6LkD?apikey=CG0C6JlnXhBUOi4R9JlJILWZGyBP6LkD',
// }
}))
[6:16pm]
👻👻👻👻👻👻👻👻👻👻👻👻👻 status === 200 data === null [6:19pm] 👻👻👻👻👻👻👻👻👻👻👻👻👻
[6:20pm]
🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳🏳
[6:56pm]
tapping out. Learned some about serverproxy even though I didn't successfully use it. also learned about webpack, and that it can prepare process.env for clientside at build time.
seeing so many jobs in so many places say: 'webpack', 'webpack', 'webpack', it makes so much more sense.
[6:58pm]
able to connect accuweatherAPI successfully. didn't need any such proxy approach
attempting to do:
242 during the solving of this issue: I was calling API incorrectly.
chatGPT led me down a waterhole of using a serverProxy route that looks like this:
error:![Screen Shot 2023-06-21 at 5 52 21 PM](https://github.com/frankcollins3/fill_container/assets/73137934/521a610b-0145-47e9-af59-c60a470853e7)
proposed approach: const serverProxyTest = await axios.get(
http://localhost:5000/isItRaining
)// separate concerns (${API} works) and do a barebones hitting of route with hard defined server path "host:5000"