ccqp
v1.0.0
Published
camelcase query params express middleware
Downloads
7
Maintainers
Readme
ccqp
express middleware to recursively transform query params keys to camel-case.
TL;DR
npm install ccqp
const express = require('express')
const ccqp = require('ccqp')
const app = express()
app.use(ccqp)
// ...
A request with the following querystring:
const qs = `
?first_name=John
&LastName=Doe
&date-of_-birth=01.01.1985
&hair.color=brown
&contact[email][email protected]
&contact[phone_number]=754-3010
`
will have the following req.query
:
{
firstName: 'John',
lastName: 'Doe',
dateOfBirth: '01.01.1985',
hairColor: 'brown',
contact: {
email: '[email protected]',
phoneNumber: '754-3010',
},
}