when serving data to an API, you don't need to close the db every request. Just open the file and use it all the time.
In development even a sqlite3 GUI tool can view the data, while the server is running. sqlite3 is made in a way, that multiple pricesses can access the file at the same time.
Tobias, thanks for pointing this out to me. I've only recently decided to pick up Node.js, and I'm bound to make oversights, so I really appreciate any corrections. I'll be sure to make adjustments to the post once I'm comfortable with the approach you've suggested.
when serving data to an API, you don't need to close the db every request. Just open the file and use it all the time.
In development even a sqlite3 GUI tool can view the data, while the server is running. sqlite3 is made in a way, that multiple pricesses can access the file at the same time.
Tobias, thanks for pointing this out to me. I've only recently decided to pick up Node.js, and I'm bound to make oversights, so I really appreciate any corrections. I'll be sure to make adjustments to the post once I'm comfortable with the approach you've suggested.
you liked that one? I also want to recommend using a Promises version of sqlite3. then you can use async/await and avoid the callback-hell.
if you like, can follow me back, then we can have private chat. I like that you share your experience. 👍