-1

I deployed my React web work as a test at Vercel but the API didn't work and my web now is Empty.. my project and api works perfectly in my localhost ! some one knows why ?

my empty web :- https://web-3-0-prokect-1.vercel.app/

api code in the useEffect hook:- https://github.com/Adelndf/web.3.0-prokect-1/blob/master/src/App.js

by the way im new in coding so some of my coding words or terms might be little bit weird :) hopefully someone understand my issue here

skyboyer
  • 22,209
  • 7
  • 57
  • 64
Adel
  • 13
  • 3
  • you have a CORS Error which basically means you API call needs to happen over a server request. You can use express, next.js and various other solutions to rewrite it quick.. – Michael Dec 14 '21 at 15:22

2 Answers2

0

Your API request is not successful because of CORS error. This usually won't be an issue when you try in localhost. To learn more about CORS, click here.

Muhammed Jaseem
  • 782
  • 6
  • 18
-1

I fixed it with the easy way cuz at the end its just a testing project.. the solution if any one needed it is :-

i added ( https://cors-anywhere.herokuapp.com/ ) before my api ulr and it works..

u can see it in github link at the top

Adel
  • 13
  • 3