Skip to content

sanjaysans/html-cors-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cors-proxy-server

A proxy server to execute API call from UI without getting CORS error. This is the easiest way to bypass cors error. It supports all REST API calls. Options JSON accepts all the general axios options.

Sample fetch request

function API_CALL() {
  var myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/json");

  // Add your custom request options here  
  var raw = JSON.stringify({
    "options": {
      "url": "http://google.com",
      "method": "GET"
    }
  });

  var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
  };

  fetch("https://html-cors-proxy.herokuapp.com/", requestOptions)
    .then(response => response.json())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published