Sha256: c927209f950d7bd79d99d848cd56ad3b436b9a687f9dd09a1190e05d2edb760b

Contents?: true

Size: 763 Bytes

Versions: 7

Compression:

Stored size: 763 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',
        'Content-Length' => body.join.size.to_s,
      },
      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.new('0.0.0.0', 3000, app).start
#

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thin-0.7.0-x86-mswin32-60 example/adapter.rb
thin-0.7.1 example/adapter.rb
thin-0.8.0 example/adapter.rb
thin-0.8.2 example/adapter.rb
thin-0.7.0 example/adapter.rb
thin-0.8.1 example/adapter.rb
thin-0.7.1-x86-mswin32-60 example/adapter.rb