Registry / database / mysql-restful

mysql-restful

JSON →
library0.8.1jsnpmunverified

A rapid RESTful API server for MySQL databases that automatically imports database structure and creates metadata for CRUD operations. Current version 0.8.1. It exposes two ports: one for administration (HTTPS) and one for API requests. Key differentiators: automatic metadata generation, batch commands with transactions, pre/post operation hooks, and SSL support. It is a self-contained server that uses Express-like patterns but is not actively maintained.

npm install mysql-restful
INSTALL
IMPORT
SIG · MYSQL-RESTFUL
M
mysql-restful
databasejavascriptv0.8.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.

server
✓ const server = require('mysql-restful');
✗ const server = require('mysql-restful').default;
CommonJS require returns the server object directly; no default export.
start
✓ server.start();
✗ server.start({port: 8080});
start() accepts an optional settings object, but not passing it uses defaults.
metadata
✓ server.getMetadata();
✗ const metadata = require('mysql-restful/metadata');
Metadata is accessed via method on server object, not a separate module.

Shows basic setup: require, optional settings, and start. Demonstrates how to connect to a MySQL database and expose RESTful endpoints.

const server = require('mysql-restful'); // Optional settings object const settings = { apiPort: 3000, adminPort: 443, protocol: 'https', database: { host: 'localhost', user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'myapp' } }; server.start(settings); // Server will scan DB and create RESTful endpoints // GET http://localhost:3000/tableName/1 -> reads record with ID 1 // POST http://localhost:3000/tableName -> inserts record
Debug
Known issues
gotchaServer requires OpenSSL to generate self-signed certificate on first start; startup fails if OpenSSL not installed.
fix
Install OpenSSL or provide ssl/service.crt and ssl/service.key files before starting.
affects: all
gotchaDefault ports are 80 (HTTP API) and 443 (HTTPS admin). On Linux, binding to these ports requires either root or setcap.
fix
Run 'sudo setcap cap_net_bind_service=+ep /usr/local/bin/node' or use non-privileged ports via settings.
affects: all
breakingMetadata is cached on startup; database schema changes after start are not reflected until server restart.
fix
Restart the server after any schema changes, or manually update metadata via admin interface.
affects: all
gotchaSelf-signed SSL certificate generated at first start is not trusted by browsers; admin interface will show security warning.
fix
Replace with a valid SSL certificate (ssl/service.crt and ssl/service.key) or disable HTTPS for admin.
affects: all
deprecatedThe package uses mysql driver (v2.x) which is deprecated; newer MySQL 8 authentication might not be supported.
fix
Consider migrating to a more modern REST API solution or patching to use mysql2.
affects: <=0.8.1
Errors
Common errors & fixes
Error: Cannot find module 'mysql-restful'
Package not installed.
fix
npm install mysql-restful --save
Error: listen EACCES: permission denied 0.0.0.0:80
Trying to bind to privileged port without sufficient permissions.
fix
Use setcap as described, or change apiPort to >1024.
Error: self signed certificate in certificate chain
Default self-signed certificate is untrusted.
fix
Add the certificate to trusted store, or use a valid certificate.
Upgrade
Version history
0.8.1latest on npm
Audit
Dependencies
mysqlrequiredNode.js MySQL driver for database connectivity
opensslrequiredRequired for self-signed SSL certificate generation
Agent activity
8 hits · last 30 days
node
8
Resources
mysql-restful — npm install mysql-restful · libregistry