简体   繁体   中英

How to “require” a .yml file?

I'm a beginner just trying to get the hang of elasticsearch with angular and have installed elasticsearch with the browserbuild here: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/browser-builds.html

I was able to get elasticsearch loaded into angular as a module and was following along with this sample repo: https://github.com/spalger/elasticsearch-angular-example/blob/master/README.md

When I tried to run the cluster.state call, I received the following error: Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.

According to the sample repo, I need to configure the elasticsearch.yml file in order to allow CORS. I couldn't seem to find this file so I created my own but how do I now get my js files to "require" or "read" from it?

This is the configuration file for elasticsearch. It does not belong to the client.
Read about elasticsearch installation in their site and setup your development elasticsearch server to work against.
Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM