Skip to content

Instantly share code, notes, and snippets.

@moro
Created November 28, 2011 04:17
Show Gist options
  • Save moro/1399082 to your computer and use it in GitHub Desktop.
Save moro/1399082 to your computer and use it in GitHub Desktop.
launch thin server by hand mounting Sinatra app
require 'bundler/setup'
require 'sinatra/base'
require 'thin'
require 'eventmachine'
class MyApp < Sinatra::Base
get '/hi' do
response[:content_type] = 'text/plain'
'hi'
end
end
server = ::Thin::Server.new('0.0.0.0', 8080, MyApp)
trap('INT') { EM.stop }
EM.run do
server.start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment