Use database with node js
- This topic has 3 replies, 3 voices, and was last updated 8 years, 1 month ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forums › Conduit: AEP Model › Use database with node js
Hello,
Is there a way to use/create database with node JS ?
I’m developping an application to send every received LoRa message with http post request. In certain conditions, the gateway has no internet connection. So I need to store every data into a database, to be able to send everything once the connection up again.
I suppose there is SQLite3 on the Multitech after finding the file /var/config/lora/lora-network-server.db. But I do not know if there is drivers for node JS. I tried to instal one with npm without success:
npm install node-red-node-sqlite
you need the npm sqlite3 package which needs to be built using node-gyp which I belive isn’t installed on the AEP due to storage/performance constraints?
The lack of a local DB is a short coming. I’ve considered https://www.npmjs.com/package/lokijs which a purse Javascript JSON DB.
But what I do is now store data in JSON format in context.global Array and then use a periodic write (inject node) to the file system of Array and re-load in Node-RED start. Not ideal but better than nothing.
Was hoping to revive this old post. I also have the problem of wanting to store data locally on the multitech. Was anyone able to figure out how to create a database on the conduit or is the solution still to use the context.global array?
Jeffery, still the same but hoping that 2nd generation Conduit will be with us soon and these constraints will be a thing of the past.