updating the API URL in your client-side code is necessary to ensure that your app makes API requests to the correct server. However, you may also need to update the server-side configuration to match the IP address or domain name changes
mongoose
.connect("mongodb://yourIpAddress/yourprojectnameinmongodb", {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() = {
console.log("Connected to Mongo Db");
})
.catch((err) = {
console.log("Error connecting to MongoDb", err);
});
if doesn't work, in place of ipaddress add 127.0.0.1:27017 it should probably work!
then ...
app.listen(port, "IpAdressofyourpc", () = {
console.log("Server is running on http://youripadress");
});
then in the frontend-part while initialising the function you need to make the change
axios
.post("http://youripadress:8000/register", user)