I’m not a new developer, but I’m new to VSCode and Angular. I’m working with a UDemy course to learn Angular and the course uses the browser “localStorage” object to save and retrieve data information. This works fine for training, but I need to use a SQLite database.
I’m trying to convert over from the localStorage to using a database created in SQLite. I will eventually create an Angular app to use an existing SQLite database, so changing databases is not an option.
I know that database connections must be done in a service module, which makes sense. I ran the terminal statement: “npm i sqlite3” and then added the import statement
"import { sqlite3 } from 'sqlite3'
at the top of my service module. Then in the constructor, I have the statement:
"const dbSqlite3 = require('sqlite3').verbose();
Everything looks fine until I compile, then I get a compiler error:
"Module not found: Error: Can't resolve 'util' in C:Userspainmyappnode_modulessqlite3lib'
I don’t even know how ‘util’ has anything to do with anything.
What I really need is a clear and basic tutorial on connecting and using simple CRUD functionality from a SQLite database in an Angular service module.
Whatever help you can give me would be greatly appreciated.