A plugin for the Diet.js web framework that provides a simplified wrapper around the popular node-mysql module. Version 2.0.0 requires Node >=5.7.0 and works with Diet.js to manage MySQL connections per request. It automatically opens a connection on each route and closes it when the response is sent. The main differentiation is tight integration with Diet.js's signal system, exposing $.mysql.query inside routes. It relies on the 'mysql' npm package and has minimal overhead (20kb). Note that this package is specific to the Diet.js framework and is not actively maintained (last update years ago).
npm install diet-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a Diet.js app, connects to MySQL, and defines a route that queries 'accounts' and returns JSON.
Consider using mysql2 directly or a more modern ORM.
Implement connection pooling manually or switch to a pool-based solution.
Always include 'app' and 'database' in connect options.
Audit or migrate to actively maintained alternatives like 'mysql2' with a custom Diet middleware.
Install diet: npm install diet
const mysql = require('diet-mysql'); mysql.connect({...});Check your MySQL user/password and pass them in connect options.