0

Having trouble adding proxy to package.json to reference backend

Generally new to React and am trying to connect my frontend to my backend. My frontend, running on port 3000, wants to retrieve data from the backend in port 5000. I want to fetch data from endpoints relative to the backend so I added "proxy":"http://localhost:5000" to package.json(). Upon running npm start, I get:

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
 - options.allowedHosts[0] should be a non-empty string.

I tried searching up solutions and have tried extra steps such as manually setting up a proxy and installing http-proxy-middleware. This is all referenced by this video.

ImJunny
  • 1
  • 2
  • Does this answer your question? [Invalid options object. Dev Server has been initialized using an options object that does not match the API schema](https://stackoverflow.com/questions/70374005/invalid-options-object-dev-server-has-been-initialized-using-an-options-object) – adsy May 27 '23 at 00:10

0 Answers0