Добрый день.
У меня фронт на React запускается через Node.js на localhost:3000 и сам сервер (api) на Node.js localhost:4000.
На фронте я пытаюсь сделать запрос:
fetch('http://localhost:4000/', {
method: "GET",
headers: {
"Content-type":
"application/x-www-form-urlencoded; charset=UTF-8"
}
})
Вы падает ошибка:
Fetch API cannot load http://localhost:4000. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Подскажите пожалуйста, что мне делать? Nginx настравивать?