How can I match a route based on query parameters?

I want example.com/user?v=Hsdfjkh to match a video and example.com/user to match the user. How can I do this?

You could do something hacky like: JS Bin - Collaborative JavaScript Debugging

I’d personally not take the approach of using queryParams here. Instead, would create two routes, one with a slug in the path for the video_id one empty indicating the user

This would work:
example.com/users/:user_id?v=Hsdfjkh