
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
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();
let conn = new 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", conn.link(Person));
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
The npm package express-sql receives a total of 2 weekly downloads. As such, express-sql popularity was classified as not popular.
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
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.