Registry / database / yeps-mysql

yeps-mysql

JSON →
library1.1.1jsnpmunverified

YEPS MySQL is a promise-based MySQL client for Node.js built on top of the mysql2 package, designed for use with the YEPS HTTP framework. Version 1.1.1 is the latest stable release. It provides a simple middleware-based approach to attach a MySQL connection pool to the request context, as well as a standalone pool module for direct use. Key differentiators include tight integration with YEPS middleware and async/await support. It requires Node >= 7.6.0 and relies on mysql2 and yeps as peer dependencies.

npm install yeps-mysql
INSTALL
IMPORT
SIG · YEPS-MYSQL
Y
yeps-mysql
databasejavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mysql
const mysql = require('yeps-mysql');
import mysql from 'yeps-mysql';
Package is CommonJS-only; no ESM exports.
pool
const pool = require('yeps-mysql/pool');
const pool = require('yeps-mysql').pool;
Submodule path must be '/pool'.
ctx.mysql
use as ctx.mysql after applying mysql middleware in YEPS app
const mysql = require('yeps-mysql'); mysql.query()
Direct query on require result is not supported; use middleware or pool module.

Sets up a YEPS app with MySQL middleware and runs a simple query.

const App = require('yeps'); const error = require('yeps-error'); const logger = require('yeps-logger'); const server = require('yeps-server'); const mysql = require('yeps-mysql'); const app = new App(); app.all([ error(), logger(), mysql(), ]); app.then(async ctx => { const rows = await ctx.mysql.query('SELECT ? AS result', ['Hello MySQL!']); ctx.res.end(JSON.stringify(rows)); }); server.createHttpServer(app);
Debug
Known issues
deprecatedNode.js >= 7.6.0 is outdated; modern versions may have breaking changes.
fix
Use Node.js >= 10.0.0 for better performance and security.
affects: >=0.0.0
gotchaThe 'yeps-mysql/pool' submodule requires config from a config/default.json file.
fix
Ensure config file exists at project root with 'mysql' key.
affects: >=0.0.0
gotchaMiddleware must be applied before route handlers; otherwise ctx.mysql will be undefined.
fix
Call app.all([...]) before app.then().
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'yeps-mysql/pool'
Incorrect import path
fix
Use require('yeps-mysql/pool') not require('yeps-mysql').pool
TypeError: ctx.mysql is undefined
MySQL middleware not applied or applied after route
fix
Ensure mysql() is included in app.all() before any routes.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
mysql2requiredUnderlying MySQL client driver
yepsoptionalFramework for middleware context
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
yeps-mysql — npm install yeps-mysql · libregistry