Created
February 19, 2009 10:37
-
-
Save Syd/66854 to your computer and use it in GitHub Desktop.
This file contains 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 'rubygems' | |
require 'eventmachine' | |
module SimpleResponse | |
def receive_data data | |
if data =~ /^GET/ | |
then | |
send_data "HTTP/1.1 200\nContent-type: text/plain\n\nHello World!" | |
close_connection_after_writing | |
else | |
close_connection | |
end | |
end | |
end | |
EventMachine::run { | |
EventMachine::start_server "0.0.0.0", 8081, SimpleResponse | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment