Search code examples
node.jssqlitenode-red

how to access sqlite database from node-red node?


I am creating a node-red API service that access SQLite database using SQLite node. How to configure the database with SQLite node?

I have hard-coded db file in SQLite node. What is the right way to develop a node-red API that access the SQLite database ? I think I want to make the database filename configurable, so that it is fetched dynamically.

I am new to node-red programming.

enter image description here


Solution

  • If the changes are only at deploy time not runtime then you can use Environment variables as described in the doc here

    If you replace the path to the DB in the config node with ${DB_PATH} then Node-RED will replace this with the value of the DB_PATH environment variable at deploy time.