The following code works with no querystrings or one querystring only. In other words, simply going to /characters
returns all
Well,
I would recommend something like this:
var query = Character.find()
if(req.params.length < 0) {
for(var key in req.params) {
query.where(req.params[key]).equals(key);
}
} else {
// do something without query params
}
this is not tested by me but it should work (maybe you need to modify it a bit but you get the idea). This solution is all about not checking what actually is in the params so be sure only good stuff comes in or validate it somewhere in the for loop, but would require some regex or if statements.
Hope this helps you.