phatnguyenuit / meta-weather

Meta Weather Forecast
https://meta-weather-seven.vercel.app
MIT License
3 stars 1 forks source link

Help! Can not reach out the request from UI to proxy server #3

Open krakowdeveloper opened 2 years ago

krakowdeveloper commented 2 years ago

could you give me a hand? I did the same API, using heroku and it works. I already set the express, nodemon, etc, but still I don't catch the request 🤦‍♂️ 😅

phatnguyenuit commented 2 years ago

Hello @juanpumpkinpie,

Thank you for using my repository as a reference!

In your situation, I think you should check the following checklist.

  1. Did your proxy server start successfully? You can check by adding some public route like /hello
  2. Did you change CORS options (https://github.com/phatnguyenuit/meta-weather-proxy/blob/7df591fdf0221a03996e4ba745c481c3e71b9bfe/server.js?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L23)? If yes, please make sure your Frontend calls the mock server with the same CORS options. (I used custom header authorization in https://github.com/phatnguyenuit/meta-weather/blob/master/src/services/metaWeather.ts maybe you forgot)

If these checklist items above do not help you resolve the problem, please share the source code, I can help you out!

Happy coding!

krakowdeveloper commented 2 years ago

Hi, thank you to your reply. I used nextjs, and in the background wasn't necessary a recursion for CORS. Besides, I'm trying to understand how to develop my own serverside to pre-path the request in the API. I saw you did something like that here, but it has a lot of modules ^^

phatnguyenuit commented 2 years ago

Hi @juanpumpkinpie, If you use nextjs, I think it is straightforward now, you can develop your own /api and call the CORS API (meta-weather) directly. No need to do some tricks as I did with the meta-weather-proxy server.

Happy coding!

krakowdeveloper commented 2 years ago

You right!, I also think took you time develop that server side. ^^ I already following you here too. Inviting you to join my close circle of goo devs on discord: https://discord.gg/wfypdY97 🙂