Registry / database / gupshup-mysql-demodb

gupshup-mysql-demodb

JSON →
library1.0.8jsnpmunverified

A demo MySQL npm module that provides a simple wrapper for basic CRUD operations (addUser, getSingleUser, getAllUsers, deleteUser). This module is intended for demonstration purposes only and connects to a MySQL database using environment variables for configuration. Version 1.0.8 is the latest stable release, though the package appears to be a demo with limited functionality. It does not appear to have frequent updates. Differentiators: minimal setup with a single initialization call and async/await support. Note: This is not production-ready and may lack security or error handling.

npm install gupshup-mysql-demodb
INSTALL
IMPORT
SIG · GUPSHUP-MYSQL-DEMO
G
gupshup-mysql-demodb
databasejavascriptv1.0.8
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 GupshupDB = require('gupshup-mysql-demodb').mysql;
const GupshupDB = require('gupshup-mysql-demodb');
The module exports an object with a 'mysql' property; direct require won't work.

Connects to MySQL using environment variables, then performs addUser, getSingleUser, getAllUsers, and deleteUser operations.

const GupshupDB = require('gupshup-mysql-demodb').mysql; GupshupDB.initializeMysql( process.env.GUPSHUP_DB_CONNECTION_URL ?? '00.224.114.86', process.env.GUPSHUP_DB_USERNAME ?? 'root', process.env.GUPSHUP_DB_PASSWORD ?? 'password', process.env.GUPSHUP_DB_DATABASE ?? 'DATABASE_NAME' ); const userId = 1; const name = 'John Wick'; let insert = await GupshupDB.addUser( userId, name ); let select1 = await GupshupDB.getSingleUser( userId ); let selectAll = await GupshupDB.getAllUsers(); let deleteUser = await GupshupDB.deleteUser( userId );
Debug
Known issues
gotchaModule requires the `.mysql` property from the package; direct require returns an object not a constructor.
fix
Use const GupshupDB = require('gupshup-mysql-demodb').mysql;
affects: *
gotchaAll methods (initializeMysql, addUser, etc.) are static on the returned object, not instance methods.
fix
Call methods directly on the imported object without instantiation.
affects: *
gotchaNo connection pooling or error handling provided; failed connections may hang.
fix
Add try/catch and connection timeout logic around initializeMysql.
affects: *
Errors
Common errors & fixes
TypeError: GupshupDB.initializeMysql is not a function
Incorrect import: const GupshupDB = require('gupshup-mysql-demodb'); missing .mysql
fix
const GupshupDB = require('gupshup-mysql-demodb').mysql;
Error: Cannot find module 'mysql' (or similar database error)
Missing or invalid environment variables, or MySQL not running.
fix
Set GUPSHUP_DB_CONNECTION_URL, GUPSHUP_DB_USERNAME, GUPSHUP_DB_PASSWORD, GUPSHUP_DB_DATABASE and ensure MySQL is accessible.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
gupshup-mysql-demodb — npm install gupshup-mysql-demodb · libregistry