Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion: Is there a way to check if a connection is connected? #1981
Comments
It's not documented (but if someone wants to write up some docs, that'd be awesome |
yes, you can put if condition when connection is connect print connected otherwise not connected. but make sure you assign connection code to a variable and thn put if condition on a vaariable...your connection code here..if($a){ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am making a health check endpoint for kubernetes (google cloud's service to host containerized applications) for my mySql application.
right now I am using this package https://www.npmjs.com/package/health-check-mysql
But is there something built into the package itself, something like a isConnected method. ie:
connection.isConnected() ? throw new Error('not connected to mysql') : null