Search code examples
sqliteelectronclojurescript

descjop template with local sqlite db?


I am working on a small desktop app with electron, using the descjop template for clojurescript. I don't have a lot of expirience in clojurescript, and I was wondering how I could add SQlite locally within electron and clojurescript. I would be gratefull to point me to the right direction, I am a little confused.


Solution

  • I don't know much about Electron or descjop, so bear with me. I searched for the problem and found an answer that shows how to include sqlite. In package.json you need to add:

    "scripts": {
      "postinstall": "install-app-deps"
    }
    

    Then you "install necessaries dependencies with":

    npm install --save-dev electron-builder
    npm install --save sqlite3
    npm run postinstall
    

    Then you can require SQLite in the core as follows:

    (def SQLite (nodejs/require "sqlite3"))
    

    Hope this helps.