skip to Main Content

I had watched a series of tutorials online and had followed lot of steps. I had to change my IP address to my machine IP, but yet network error. even, I had to change it to 127.0.0.1. Am just so tired, I need help badly. I am using a project on the PHPMyAdmin database, which I use to fetch the result using express and node MySQL. I did all I could I even used USB tethering, hotspot, and all but none seems to work

const GetUserData =()=>{
   axios.get("http://127.0.0.1:3000/users").then(
       (response)=>{
        console.log(response.data);
   }).catch(err =>{
       console.log(err);
   })
}; 

useEffect(() => {
  GetUserData()
},[])

2

Answers


  1. Can you add the error message, please? If you face CORS you can fix it by:

    var cors = require('cors')
    var app = express()
    app.use(cors())
    
    Login or Signup to reply.
  2. Your machine has multiple IP addresses, even with one network device.

    Of them:

    • 127.0.0.1 – local IP address. It is not on any network device, and it should not be there.
    • 192.168.x.y – network IP address. It is configured on the network device (manually or automatically).

    You don’t need to install 127.0.0.1 on a network device. 127.0.0.1 is already your machine, even without any network devices.

    Also, to be able to make requests to 127.0.0.1:3000, some service must already listen on this port.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search