Express middleware that provides MySQL connection pooling, automatically attaching a connection to each request and releasing it on response end. Version 1.0.3 (latest, no recent updates). Simple wrapper around mysql module's pool; focuses on request-scoped connections. Alternatives: express-mysql-connection (individual connections), mysql2/promise pool (modern).
npm install express-mysql-poolNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up Express middleware to attach MySQL pool connection to each request, queries a table, returns JSON.
Wrap req.getConnection and conn.query in util.promisify or use mysql2/promise.
Ensure you use the 'mysql' package (not mysql2) unless compatibility is confirmed.
Switch to mysql2 for modern features and security updates.
Ensure app.use(myConn(mysql, dbOptions)) is called before routes that use req.getConnection.
Use separate connections for parallel queries or chain them with callbacks.
Restart MySQL server or reinitialize middleware.