I'm building an electron-app which uses a database. The problem: every time I need to add new code, I need to create a connection to the database. I do it this way:

let db = new sqlite3.Database('./appdata/resources/protodatabase.evv');

Is there a way to create a global variable or something similar which holds this filepath? So I don't have to hardcode the filepath in the program?

1 Answers

0
Dupinder Singh On Best Solutions

Onload application, you can save the path in localstorage, provided by JavaScript

this can help you!

  localStorage.setItem("lastname", "Smith");
  // Retrieve
  document.getElementById("result").innerHTML = localStorage.getItem("lastname");