title: rails routing to controllers in a sub folder?
body: <p>I have a requirement any url like:  <code>www.servername.com/api/foo/bar/parameters</code> </p>
  
  <p>where:</p>
  
  <ul>
  <li><code>api</code> is static</li>
  <li><code>foo</code> is the controller</li>
  <li><code>bar</code> is action</li>
  <li><code>parameters</code> are params</li>
  </ul>
  
  <p>to map to the controllers which are in <code>api</code> directory </p>
  
  <blockquote>
    <p>(<em>the api directory is in controllers directory</em>)</p>
  </blockquote>
  
  <p>to achieve this I did the below code but it doesn't work. Any suggestions?</p>
  
  <pre><code> namespace :api do
     match "/api/:controller(/:action(/*params))", via: [:get, :post]
   end
  </code></pre>