One of the cool things about node is that you don't have to open and
close database connections with every http request. Instead you create
one single connection during startup and use it for all http requests.
When your node program shuts down, you close the connection as well.
Your program does not quit because the connection to the MySQL server
still does exist and node listens for data until you tell node to
close it. Then your program has nothing left to do and will exit.
On Dec 26, 11:19 am, Santacruz <
vorand...@gmail.com> wrote:
> My code athttps://
github.com/santacruz123/node-bitcoin-arb
>
> Usinghttps://
github.com/felixge/node-mysqlfor MySQL
>
> I don't want to close/open connection before every function, but if I
> don't do "db.end()" my script does not exit.
>
> This is how I create object -
https://github.com/santacruz123/node-bitcoin-arb/blob/master/mysql.js