You can use the proxy service by simply adding https://proxy.cors.sh/ to your existing api
fetch('https://proxy.cors.sh/https://acme.com', {
headers: {
'x-cors-api-key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
}
});
// or...
functon fetchWithProxy(url, params){
return fetch(`https://proxy.cors.sh/${url}`,
{
...params,
headers:
{
...params.headers,
'x-cors-api-key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
}
});
}
fetchWithProxy('https://acme.com')