
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
express-sql
Advanced tools
🚨 This package is in early development. Things might not work as intended or might not be documented properly.If you stumble upon a problem or a potential improvement, please open an issue or PR!
CRUD (Create, Read, Update, Delete) style object mapping for SQL objects.
$ npm install express-sql
const express = require("express");
const eSQL = require("express-sql");
const app = express();
app.use(
eSQL.Connection({
host: "localhost:3306",
username: "timmy",
password: "letmein"
})
)
let Person = new eSQL.Object({
primaryKey: "ID",
table: "people",
schema: {
ID: Number,
Name: String
}
})
app.use("/people", Person.use());
app.listen(3000);
eSQL.Connection shares the same options as the connection object in mysql.
The above example creates 4 routes
POST /people - { ID: Number, Name: String }
GET /people/:ID - ID=Number
PUT /people/:ID - ID=Number, { Name: String }
DELETE /people/:ID - ID=Number
POST /people - { ID: 1, Name: 'Homer', Cool: false }: 400 Bad Request
eSQL will verify the params for any request according to the schema before sending it to SQL.
If you want to modify the request body to make your SQL schema different from your API schema, you can specify a mapping.
new eSQL.Object({
primaryKey
schema: {
ID: Number,
Name: String
},
mapping: {
id: "ID",
firstname: "Name"
}
})
{
primaryKey: "id",
schema: {
id: ["ID", Number],
firstname: ["Name", String]
}
}
this has the same effect
new eSQL.Object({
primaryKey: 'ID',
pathAlias: 'personId', // Changes the express route to /:personId
table: 'people', // The table to do operations on
makeID: () => uuid(), // Specify the method to create the id from
schema: {
ID: Number,
Name: String
},
})
String, Number, Boolean are the only types supported by eSQL right now (more to come). However you can specify types to lock down your schema definition.
const { Enum, Null, Fixed } = require('express-sql');
{
ID: Fixed(Number, 6), // limits the ID to 6 digits
PayType: Enum("Hourly", "Salary"),
Name: Null(String)
}
FAQs
Easy SQL object management with express
We found that express-sql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.