node.js - How to integrate Firebase Flashlight in my application -


i trying integrate firebase flashlight elasticsearch in node.js application in order make search operations on firebase collections. want in api.js define search routes (e.g: myhost: myport/ search/mycollection/:key).

the problem that myport different 1 on elasticsearch running (which 9200).

i want on route: myhost: myport/whatever run app, , on route myhost: myport/ search/mycollection/:key run search available @ myhost:9200.

how can integrate them in express?

when config elasticsearch, use:

var config = {       host: 'localhost',       port: 9200,       log: 'trace' }; var esc = new elasticsearch.client(config); 

it's normal elastic search run on different port express application. in fact, can not have 2 servers running on same port.

flashlight more different app, need run on server. using npm start or npm monitor can start flashlight process after setting configuration file. flashlight take care bring data firebase in elastic search.

to interact elastic search, have use node module. that. elastic search run on port 9200, mentioned, while express app run on different port (e.g. 3000).

inspired flashlight, created elasticfire has few features flashlight doesn't have (e.g. joins), , can used library in app.

const elasticfire = require("elasticfire");  // initialize elasticfire instance let ef = new elasticfire({      // set firebase configuration     firebase: {         apikey: "ai...by",         authdomain: "em...d.firebaseapp.com",         databaseurl: "https://em...d.firebaseio.com",         storagebucket: "em...d.appspot.com",         messagingsenderid: "95...36"     }      // firebase paths , how index them in elasticsearch   , paths: [        {            // firebase path            path : "articles"             // elasticsearch index , type          , index: "articles"          , type : "article"             // optional joined fields          , joins: [                // `author` field article                // points `users` collection.                {                    path: "users"                  , name: "author"                }                 // if have array of comment ids, pointing                // collection, joined              , {                    path: "comments"                  , name: "comments"                }            ]             // filter out data          , filter: (data, snap) => snap.key !== "_id"        }     ] });  // listen events emitted // elasticfire instanceand output data ef.on("error", err => {     console.error(err); }).on("index_created", name => {     console.log(`${name} created`); }).on("index_updated", name => {     console.log(`${name} updated`); }).on("index_deleted", name => {     console.log(`${name} deleted`); }); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -