1.0.0 • Published 2 years ago

qsql v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
2 years ago

Attention: not for a usage in current status. In deep development! Please, don't install it for now. Wait for the future versions.

An Express middleware to convert query parameters to SQL query.

Features

  • Provide a simple language on-top of url query parameters format to constructing SQL queries.
  • Automatically construct knex builder object based on query parameters.
  • Provide ability to get raw SQL query as string or with bindings to use anywhere.

Install

npm i qsql --save

Usage

Configuration

const qsql = require('qsql');
const express = require('express');

const app = express();

app.use(qsql({
    client: 'pg'
}));

app.get('/products', (req, res, next) => {
    // req.qsql - ready to use `knex` builder
    // use req.qsql.toString() to get SQL query as string
    // use req.qsql.toSQL() to get SQL query with bindings
});

app.listen(process.env.PORT);
1.0.0

2 years ago

0.0.1-security

8 years ago

0.2.2

9 years ago

0.2.0

10 years ago