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]=john.doe@example.com
&contact[phone_number]=754-3010
`
will have the following req.query
:
{
firstName: 'John',
lastName: 'Doe',
dateOfBirth: '01.01.1985',
hairColor: 'brown',
contact: {
email: 'john.doe@example.com',
phoneNumber: '754-3010',
},
}