How to create a route by file extension?


I want to have a controller that handles serving all .js files. But I
don’t know how to write the routes.rb map.connect entry so all requests
for javascript files can be routed to my controller.

The .js requests sometimes can have dynamic parameters, such as:

Any idea how to write the routes entry?