require 'sinatra/base'
class Foo < Sinatra::Base
get('/foo') { 'foo' }
end
class Bar < Sinatra::Base
get('/bar') { 'bar' }
end
run Rack::Cascade, [Foo, Bar]
I just can't guess what is wrong with this code. When I ran: ruby server.rb, it throws an error
First of all, the last line should read
But you can only use this in a Rackup File. So second, you need to create a File called config.ru (Rackup File) with the following contents:
and a file called app.rb with your actual app:
then you can start the server by typing in the command line
after that, open a second command line window and test your app: