Sha256: c0e87e4291243a825cff438320a06e9682ecf9832b3252d756e3de9390ec7138

Contents?: true

Size: 757 Bytes

Versions: 6

Compression:

Stored size: 757 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-Type' => 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

6 entries across 6 versions & 1 rubygems

Version Path
thin-0.6.4 example/adapter.rb
thin-0.6.3-x86-mswin32-60 example/adapter.rb
thin-0.6.2 example/adapter.rb
thin-0.6.2-x86-mswin32-60 example/adapter.rb
thin-0.6.4-x86-mswin32-60 example/adapter.rb
thin-0.6.3 example/adapter.rb