I want to build a small app using:
- Electron
- Angular
- SQLite
I am trying to connect to an SQLite DB and I found that there are multiple approaches. There are 2 that interested me:
- Using a library such as sqlite3.
- Using IPC that Electron library makes available: IpcRender and IpcMain
For now I've tried the first approach. Using this repository as starting point I get errors after npm install sqlite3
such as:
./node_modules/tar/node_modules/mkdirp/lib/use-native.js:1:11-24 -
Error: Module not found: Error: Can't resolve 'fs' in '.../angular-electron/node_modules/tar/node_modules/mkdirp/lib'
For the second approach I found this article published on Feb 15, 2019 which uses electron-forge to generate the project with Angular 2 template and for the database connection it uses IpcRender.
I don't understand if I am doing something wrong, or if this library isn't compatible with the project or if I should switch to the second approach.
How is the second approach with IpcMain and IpcRender using typeorm library compared with using sqlite3 directly in an Angular Service, performance wise and best practice?