Convert query strings to dates for express/connect applications.
npm install git+https://github.com/seungyong/express-query-boolean.git
The module will recursively attempt to parse every property in req.query
.
Load it right after bodyParser
:
import boolParser from "express-query-boolean";
// [...]
app.use(bodyParser.json());
app.use(boolParser());
// ?a=true&b[c]=false
console.log(req.query);
// => { a: 'true', b: { c: 'false' } }
// ?a=true&b[c]=false
console.log(req.query);
// => { a: true, b: { c: false } }
Copyright (c) 2015 Marius Craciunoiu. Licensed under the MIT license.