I am trying to set up a sinatra app inside my Rails 3 (v3.0.1) application, but having no success. Sinatra gem (v1.1.0) is setup using bundle install.
Here’s what i have.
customer_app.rb class in lib directory –
class CustomerApp < Sinatra::Base
get "/test" do
"Hello World"
end
end
my routes.rb file contains –
CustomerService::Application.routes.draw do
root :to => CustomerApp
end
The URL i am trying is – http://localhost:3000/test
I get this error (on the browser) – Routing Error. No route matches “/test”
and this error in the log – ActionController::RoutingError (No route matches “/test”):
Is there anything I am missing??
Also I just noticed, even a simple rack route is not working –
root :to => proc { |env| [200, {}, ["Welcome!"]]}
The
rootkeyword by default maps only the path/.So you are trying to say, forward any request for
/toCustomerAppwhich can handle requests for/test.You should change the match filter.