dmcquay / node-apac

node-apac - Node.js client for the Amazon Product Advertising API, including support of Request Signatures
MIT License
499 stars 111 forks source link

(help needed) No 'Access-Control-Allow-Origin' header is present on the requested resource. #77

Closed devgripes closed 7 years ago

devgripes commented 7 years ago

i tried using this library and had an error.

maybe someone here can help me to figure this out.

Fetch API cannot load 

No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:3001' is therefore not allowed access. 
The response had HTTP status code 400. 
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

i also have this on my server.js file

app.get('*', (req, res) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
  res.sendFile(`${__dirname}/dist/index.html`)
})

thanks in advance

dmcquay commented 7 years ago

Hey @kuronaru - If I understand correctly, your problem is purely a CORS problem and relates in no way to node-apac. This is not a good place for that question. Feel free to re-open if I am misunderstanding.