rohan-paul / chainable-dropdown-list

Small MERN app where one dropdown lists should get updated based on selections made on other dropdown list
4 stars 0 forks source link

create-react-app proxy not working #1

Closed rohan-paul closed 5 years ago

rohan-paul commented 6 years ago

In my .client/package.json I have the following

"proxy": {
    "/": {
      "target": "http://localhost:5000/",
      "secure": false
    }

But in my app.js axios requst is not working if I just put like below

axios.get('/')

I have to put the full url - axios.get('http://localhost:5000/')

niinpatel commented 6 years ago

I'm facing the same issue. Found any solution for this?

rohan-paul commented 5 years ago

Resolved it by doing the below in server.js

app.use('/api', car);

And in ..src/App.js the below

axios.get('/api')

niinpatel commented 5 years ago

Oh yeah! I figured that too!