I used the koa project generated by koa-generator. The routing part is written as follows:
router.get("/test",async (ctx, next) =>{
});
Mysql needs to be used. I chose the promise form of mysql2. Directly refer to the following link:
https://github.com/sidorares/...
But every once in a while, an error will be reported:
events.js:163
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:1050:11)
at TCP.onread (net.js:582:26)
I am here to ask about the reason for this error and how to solve it in this case. Thank you.
光陰似箭催人老,日月如移越少年。
Add two ways to manually close the connection after an exception
connection.end(function(err) {
// The connection is terminated now
});
--------------------
connection.destroy();