A simple Hapi.js plugin that provides a MySQL database connection pool using the mysql npm package. Current stable version is 1.0.16, with low release cadence (last update 2016). It exposes a connection pool via server.plugins['hapi-mysql'].pool, allowing query execution through the mysql driver's pool API. Key differentiator: minimalistic plugin that does not abstract MySQL queries; it simply integrates mysql connection pooling into Hapi's plugin system. Alternative modern approach: use @hapi/hapi with @hapi/glue and a dedicated mysql or sequelize plugin.
npm install hapi-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers hapi-mysql plugin on a Hapi.js server and uses the pool to run a SELECT query in a route handler.
Use server.register({ register: require('hapi-mysql'), options: config }, callback) for Hapi v17+.Migrate to mysql2 and update connection handling to use promises.
Always access the pool inside a route handler or plugin callback where 'request' or 'server' is properly scoped.
Always release the connection in a finally block or use pool.query for single queries.
Ensure plugin registration is completed before accessing plugins. Access via request.server.plugins inside route handlers.
Verify DB_HOST, DB_USER, DB_PASSWORD, and DB_NAME environment variables or configuration object.
Run 'npm install hapi-mysql' and ensure the module is required correctly.