Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 331
Alexey Zakharov Avatar asked Dec 24 '11 09:12

Alexey Zakharov


1 Answers

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
like image 80
lucapette Avatar answered Nov 06 '22 14:11

lucapette