A lightweight helper library for building common MySQL queries in Node.js. Version 1.0.9 is the latest stable release, with infrequent updates. It wraps the mysqljs/mysql package and provides simple functions like selectAllSQL, selectWhereSQL, insertSQL, updateSQL, and deleteSQL to reduce boilerplate. Unlike ORMs like Sequelize or TypeORM, it offers a minimal, direct query builder without schema mapping or migrations. Requires mysql and dotenv as peer dependencies. Ships with TypeScript definitions.
npm install node-mysql-queriesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes MySQL connection from environment variables, then demonstrates insert and select all operations.
Run 'npm install mysql dotenv' alongside this package.
Pass an object with the required structure: { status: (code) => ({ json: (data) => {...} }) }.Wrap calls in try-catch or use a custom wrapper to manage errors.
Consider using a more modern driver like mysql2 or switch to an ORM that patches security issues.
Ensure 'res' is an Express-like response object, or pass a mock object: { json: (data) => console.log(data) }.Verify .env file has 'DB_HOST' set and is loaded with dotenv.config() before any DB calls.
Double-check credentials in .env and ensure the user has permissions on the specified database.