chinmay021 / fooodvilla

Namaste React by Akshay Saini
https://fooodvilla.vercel.app
8 stars 4 forks source link

Swiggy Menu Api got changed And the app is not able to display the menu #4

Closed Aneeshh18 closed 1 year ago

Aneeshh18 commented 1 year ago

The app gets broken after clicking to show a menu for a restaurant.

Aneeshh18 commented 1 year ago

Can i fix it?

chinmay021 commented 1 year ago

Sure give it a try. Let me know if you need any help.

Aneeshh18 commented 1 year ago

Sure give it a try. Let me know if you need any help.

Yeah, I got an issue you can help me out!! The API_URL is not working for me as you have added cors_url + swiggy restaurant API, and if i use the URL directly without CORS then it's working fine can you help me out with and prerequisites for Using CORS.

chinmay021 commented 1 year ago

To solve the CORS issue I have used netlify redirect . There is netlify.toml file where I have a redirect logic. So for the url

API_URL =
  CORS_PROXY_URL + "/dapi/restaurants/list/v5?page_type=DESKTOP_WEB_LISTING&";

will be redirected to https://www.swiggy.com/dapi/restaurants/list/v5?page_type=DESKTOP_WEB_LISTING&.

You can go ahead with whatever works for you and create a PR. I'll review and make the necessary changes

Aneeshh18 commented 1 year ago

To solve the CORS issue I have used netlify redirect . There is netlify.toml file where I have a redirect logic. So for the url

API_URL =
  CORS_PROXY_URL + "/dapi/restaurants/list/v5?page_type=DESKTOP_WEB_LISTING&";

will be redirected to https://www.swiggy.com/dapi/restaurants/list/v5?page_type=DESKTOP_WEB_LISTING&.

You can go ahead with whatever works for you and create a PR. I'll review and make the necessary changes

Can you please help me with the CORS thing? Can you explain from scratch or any resource from where you learned? I'm doing the same but it isn't working for me! I have installed npm netlify cl and all cors 2 I have added the links like cors+dapi... and I have created the netlify.toml file but it is still not working.

chinmay021 commented 1 year ago

you need to run ntl dev to run the project instead of npm start

Aneeshh18 commented 1 year ago

Thanks!! What changes need to be done in the netlify server... like if was using npm build so i have to change it to ntl dev?

chinmay021 commented 1 year ago

everything would be same just run the commandntl dev instead of npm startrest keep everything as it is.

chinmay021 commented 1 year ago

this is fixed now