문제

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.

도움이 되었습니까?

해결책

You can use a constraints

YourAppName::Application.routes.draw do
  constraints :subdomain => "api" do
    mount API => '/'
  end
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top