# How to create a route by file extension?

**URL:** <https://www.ruby-forum.com/t/how-to-create-a-route-by-file-extension/88106>\
**Category:** Rails\
**Created:** [March 8, 2007, 8:17am UTC](https://www.ruby-forum.com/t/how-to-create-a-route-by-file-extension/88106 "2007-03-08T08:17:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@snowbug](https://www.ruby-forum.com/u/snowbug)\
**Post date:** [March 8, 2007, 8:17am UTC](https://www.ruby-forum.com/t/how-to-create-a-route-by-file-extension/88106/1 "2007-03-08T08:17:38Z")

</div>

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:  
prototype.js?234241.

Any idea how to write the routes entry?

Thanks!
