¿Por qué no usas forEach o algo así?
function endPoint (req, res) {
const queriesFound ={}
req.query.forEach(query=>{
queriesFound[query]=query;
}
QueriesFound will be an object
{ “Name”:”Name”, “AnotherParam”:”AnotherParam” }
}
//QueriesFound será un objeto
{“Nombre”:”Nombre”,“OtroParam”:”OtroParam”}