Connect/Express middleware for MySQL connection lifecycle management. Version 1.0.4 (last released 2018). Provides three strategies: 'single' (singleton connection per app), 'pool' (connection pool, auto-released at response end), and 'request' (new connection per request, auto-closed). Uses node-mysql as the underlying driver. Differentiator: auto-closing/releasing connections for pool and request strategies, preventing connection leaks. No major updates since 2018; considered stable but not actively maintained.
npm install express-myconnectionNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up Express app with mysql connection pool; uses req.getConnection to run a query.
Replace require('mysql') with require('mysql2') and adapt if needed.Use 'pool' or 'request' strategy for production.
Ensure app.use(myConnection(...)) is placed before route definitions.
Always pass lowercase string e.g., 'pool'.
Run: npm install mysql
Place app.use(myConnection(...)) before all routes that use req.getConnection.
Use: const myConnection = require('express-myconnection');