Express 4 route handling with named parameters and router.param()

Is there a clean way to handle key/value query params in Express 4 routes?

router.route('/some/route?category=:myCategory')

I want to detect the presence of 'myCategory' in this route and use router.param([name], callback) to handle the associated logic.

router.param('myCategory', function(req, res, next, id) {
    /* some logic here... */
});

The above 'router.param()' works fine if I have a route like /some/route/:myCategory but fails if I use

router.route('/some/route?category=:myCategory')

Am I doing something wrong here, or is this not supported in the Express 4 router out of the box?

Express treats properties after a ? as query params. So for:

/some/route?mycategory=mine

you would have to use:

req.query.mycategory or req.query['mycategory']

See this for more examples.