Created
March 17, 2009 14:40
-
-
Save HusseinMorsy/80565 to your computer and use it in GitHub Desktop.
A simpe rack example
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
# simple rack-example | |
# for more see | |
# http://m.onkey.org/2008/11/17/ruby-on-rack-1 | |
# and | |
# http://m.onkey.org/2008/11/18/ruby-on-rack-2-rack-builder | |
require 'rubygems' | |
require 'rack' | |
class HelloWorld | |
def call(env) | |
case env["REQUEST_PATH"] | |
when "/" | |
[200, {"Content-Type" => "text/html"}, 'index'] | |
when "/demo/goodby.php" | |
[200, {"Content-Type" => "text/html"}, "goodby"] | |
else | |
[404, {"Content-Type" => "text/html"}, "Not found"] | |
end | |
end | |
end | |
Rack::Handler::Mongrel.run HelloWorld.new, :Port => 9292 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment