I can’t seem to get Algolia search running from the server. I install Algolia from npm and use this code:
var algoliasearch = require('algoliasearch'); var client = algoliasearch('applicationID', 'apiKey'); var index = client.initIndex('indexName'); index.search('something', function searchDone(err, content) { console.log(err, content); });
and it gives me this error:
Refused to set unsafe header "connection" Refused to set unsafe header "accept-encoding" Refused to set unsafe header "content-length" XMLHttpRequest cannot load https://xxxxx-dsn.algolia.net/1/indexes/companies/query. Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.
I’ve seen people suggesting to run from the server via a Method, but I obviously don’t wanna hit the server for each search.
Any help would be greatly appreciated