'Missing CORS on the response header

Basically I'd like to know if it's up to the company(https://documenu.com/) to "fix" one of their endpoints or if it has something to do with my code.

I tried almost all of the other endpoints(https://documenu.com/docs) with the same code below and all of them worked fine except the one being discussed here.

The error message I get is:

Ensure CORS response header values are valid

A cross-origin resource sharing (CORS) request was blocked because of invalid or missing response headers of the request or the associated preflight request.

To fix this issue, ensure the response to the CORS request and/or the associated preflight request are not missing headers and use valid header values.

Note that if an opaque response is sufficient, the request's mode can be set to no-cors to fetch the resource with CORS disabled; that way CORS headers are not required but the response content is inaccessible (opaque).

I've tried using through Node,Live-reload but nothing.

I read about CORS and from what I understood, it would be up to the company to add CORS to their responses' headers.

What do you guys think?

Thank you for the help

const api = apiKey;
const myHeaders = new Headers();

myHeaders.append('x-api-key', api);

const requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow',
  mode: 'cors',
};
const endpoint = 'https://api.documenu.com/v2/menuitems/search/geo?lat=40.688072&lon=-73.997385&distance=1&search=buffalo%20chicken';

fetch(`${endpoint}`, requestOptions)
  .then((res) => res.json())
  .then((data) => console.log(data));



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source