In my current project, I am developing a backend application using node with typescript / javascript. The backend is linked to an sqlite database, and I have organized the code so that all database operations are contained in one file.
I'm facing a decision on whether to create a module that will be required by other modules, or to use a class that establishes a connection to the database in its constructor method.
Personally, I find it odd to encapsulate all database functionality in a non-object module. What would be considered the best practice in this scenario, and why? (I realize this may seem like a simple question, but as a hobbyist, I appreciate any guidance)
Thank you in advance