Pregunta

My Rails 3 app is using Grape API. I know how to mount that API on a selected route mount API => '/api' but I need that api to be accessible on subdomain api.mydomain.com.

I searched Grape & Sinatra docs, questions on stack overflow and tried to google it, but I can't find any solution.

¿Fue útil?

Solución

You can use a constraints

YourAppName::Application.routes.draw do
  constraints :subdomain => "api" do
    mount API => '/'
  end
end
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top