Answers for "TypeError: Failed to fetch"

0

TypeError: Failed to fetch

//The Problem is caused by Cross-origin (CORS)
//make sure you allow the origin you want your app to connect with:
Access-Control-Allow-Origin = "domain.com"

//or to allow all
Access-Control-Allow-Origin = "*"


//node js
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});
Posted by: Guest on August-07-2021

Code answers related to "TypeError: Failed to fetch"

Code answers related to "Javascript"

Browse Popular Code Answers by Language