Sha256: 64a87910945510a2422bcf1ba05bddd6964fd2895149fff08c475cef94f813e9

Contents?: true

Size: 693 Bytes

Versions: 7

Compression:

Stored size: 693 Bytes

Contents

# Run with: ruby adapter.rb
# Then browse to http://localhost:3000/test
# and http://localhost:3000/files/adapter.rb
require File.dirname(__FILE__) + '/../lib/thin'

class SimpleAdapter
  def call(env)
    body = ["hello!"]
    [
      200,
      { 'Content-Type' => 'text/plain' },
      body
    ]
  end
end

Thin::Server.start('0.0.0.0', 3000) do
  use Rack::CommonLogger
  map '/test' do
    run SimpleAdapter.new
  end
  map '/files' do
    run Rack::File.new('.')
  end
end

# You could also start the server like this:
#
#   app = Rack::URLMap.new('/test'  => SimpleAdapter.new,
#                          '/files' => Rack::File.new('.'))
#   Thin::Server.start('0.0.0.0', 3000, app)
#

Version data entries

7 entries across 7 versions & 4 rubygems

Version Path
grockit-thin-0.8.2 example/adapter.rb
macournoyer-thin-1.0.1 example/adapter.rb
macournoyer-thin-1.1.0 example/adapter.rb
michaelyta-thin-1.2.2 example/adapter.rb
thin-1.2.2 example/adapter.rb
thin-1.2.1 example/adapter.rb
thin-1.0.0 example/adapter.rb