Registry / database / wf-mysql-ddd

wf-mysql-ddd

JSON →
library1.0.21jsnpmunverified

wf-mysql-ddd is a lightweight Node.js library that bridges MySQL stored procedures with a RESTful API, following a Domain-Driven Design (DDD) pattern. Current version: 1.0.21. It allows developers to expose MySQL stored procedures as API endpoints with automatic routing and user authentication via Redis-backed token cookies. Key differentiators include minimal setup, direct mapping of stored procedures to HTTP endpoints, and built-in session management. Release cadence is irregular; no updates since initial releases.

npm install wf-mysql-ddd
INSTALL
IMPORT
SIG · WF-MYSQL-DDD
W
wf-mysql-ddd
databasejavascriptv1.0.21
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.

ddd
const ddd = require('wf-mysql-ddd');
import ddd from 'wf-mysql-ddd';
The library does not support ESM imports; only CommonJS require is available.
Router
ddd.Router
Router is a property of the ddd object, not a named export.
ddd.exec
ddd.exec({ sp: 'procedure_name', token: '...', data: {...}, callback: (err, r) => {...} })
exec is a method on the ddd object for backend calls.

Initializes the library with MySQL and Redis config, then mounts the auto-generated API router at /api.

const ddd = require('wf-mysql-ddd'); const config = require('./config'); ddd.conn = config.mysql; ddd.redis = config.redis; const express = require('express'); const app = express(); app.use('/api', ddd.Router); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
gotchaOnly stored procedures prefixed with 'ddd_' are exposed via the API. Other procedures cannot be called from the frontend.
fix
Prefix the stored procedure name with 'ddd_' if it should be accessible from the API.
affects: <=1.0.21
gotchaRequires a Redis server for token-based authentication. No auth is performed if Redis is not configured.
fix
Set ddd.redis to a valid Redis client object with host and port.
affects: <=1.0.21
gotchaThe library uses a fixed cookie name 'token' for authentication. Custom cookie names are not supported.
fix
Set your login system to use 'token' cookie.
affects: <=1.0.21
Errors
Common errors & fixes
Cannot find module 'wf-mysql-ddd'
The package is not installed or npm install failed.
fix
Run 'npm install wf-mysql-ddd' in your project directory.
TypeError: Cannot set properties of undefined (setting 'conn')
The ddd module was not loaded correctly, likely due to missing Redis dependency.
fix
Ensure Redis is installed and configured in ddd.redis.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user
MySQL credentials in config.js are incorrect.
fix
Verify the host, user, password, and database in your config file.
Upgrade
Version history
1.0.21latest on npm
Audit
Dependencies
mysqlrequiredRequired for MySQL database connectivity
redisrequiredRequired for token-based session storage
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
3
Meta
2
Resources
wf-mysql-ddd — npm install wf-mysql-ddd · libregistry