I am porting over a DJANGO API to Node.js and have a requirement to support .json at the end of a route.
Example: a GET to /users/:id/.json would return the JSON object representing the user.
The problem is that I have some routes with custom behavior, so I need it to return the same logic I would run as if I did a GET to /users/:id.
I can easily duplicate the original route and add /.json to it, but that is not the way I'd like to do it for obvious reasons.
What approach could I use to 'automatically' tack a .json handler to the end of a route, and have it instead use a different custom route?