Alexey Zakharov
Alexey Zakharov

Reputation: 25110

How can I run sinatra inside existing rails application?

I've got a rails application it contains web interface and api.

I want to rewrite api using sinatra. I want all requests to "/api/..." to be handled by sinatra and ignored by rails.

Is that possible?

Upvotes: 5

Views: 750

Answers (1)

lucapette
lucapette

Reputation: 20724

Yes it is possibile. See mount. With that you can do something like:

FooApp::Application.routes.draw do
  root :to => 'welcome#index'
  mount FooAppApi => "/api" 
end

Upvotes: 9

Related Questions