Created
November 28, 2011 04:17
-
-
Save moro/1399082 to your computer and use it in GitHub Desktop.
launch thin server by hand mounting Sinatra app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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