Tuesday 29 August 2017

Preferred method for sharing a database connection across files

Hi, relatively new to webdev so excuse any ignorance.I've been researching ways of sharing my db connection across multiple route controllers, all in different files. I'm using Express and SQLite.From what I can see there are 2 main approaches, either making a db file, connecting there and then passing the connection around by requiring that file or storing the connection in app.local.Is there a preferred method between those 2 or any pros/cons I should be aware of? I won't be using clusters or connection pooling, the app will always see very low traffic. Is there any other methods or anything I should know?Thanks guys.

Submitted August 29, 2017 at 10:50AM by weiry6922

No comments:

Post a Comment