I defined mysql connection with all parameters necessary to app.js, how can make visible to other scripts in routes/ by default, without requiring or redefining mysql parameters, just using client.query(..)?
I defined mysql connection with all parameters necessary to app.js , how can make
Share
You can inject mysql connection into other scripts like this:
app.js
main.js
UPDATE:
You can inject several variables same way. Also you still can export methods from module if you need this:
app.js
news.js