Routes in Mean.JS

I have a case where I need to expose the following server routes:

/cats/:catId /cats?name=:name

How should my server routes look? I tired this:

app.route('/cats/:catId')
        .get(cats.read)

app.route('/cats?name=:name')
        .get(cats.getByName)

But that doesn't work. I seem to get routed to /cats in that case.

Should I have a route like this, or should I just do a switch in my server controller to handle the query strings as appropriate?

you are getting into a route conflict, you are doing a fallback into the first route you are defining with the string cats, I'd would suggest to change the pattern if possible, to avoid it, follow a restful naming convention, it could be the case of:

app.route('/cats/id/:catId').get(cats.read)
app.route('/cats/name/:name').get(cats.getByName)

does that makes sense?