React: Axios Network Error
If Creating an API Using NodeJS
Your Express app needs to use CORS (Cross-Origin Resource Sharing). Add the following to your server file:
// This should already be declared in your API file
var app = express();
// ADD THIS
var cors = require('cors');
app.use(cors());
For fuller understanding of CORS, please read the Mozilla Documentation on CORS.
my problem was about the url I was requesting to. I hadn't inserted http://
at the beginning of my url. I mean I was requesting to a url like 92.920.920.920/api/Token
instead of http://92.920.920.920/api/Token
. adding http://
solved my problem.