class Rack::Builder

def map(path, &block)

outside the block.
Note that providing a +path+ of +/+ will ignore any default application given in a +run+ statement

This example includes a piece of middleware which will run before +/heartbeat+ requests hit +Heartbeat+.

end
run App.new
end
run Heartbeat.new
use Middleware
map '/heartbeat' do
app = Rack::Builder.app do

The +use+ method can also be used inside the block to specify middleware to run under a specific path:

run app

end
run App.new
end
run Heartbeat.new
map '/heartbeat' do
app = Rack::Builder.app do

end
end
[200, { "content-type" => "text/plain" }, ["OK"]]
def call(env)
class Heartbeat

end
end
[200, {'content-type' => 'text/plain'}, ["Hello World"]]
def call(env)
class App

default application specified by run outside the block.
the Rack application specified by run inside the block. Other requests will be sent to the
Creates a route within the application. Routes under the mapped path will be sent to
def map(path, &block)
  @map ||= {}
  @map[path] = block
end