Created
April 13, 2013 00:07
-
-
Save cheald/5376153 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
chris@luna ~ (master*) $ telnet localhost 8080 | |
Trying 127.0.0.1... | |
Connected to localhost. | |
Escape character is '^]'. | |
GET /?name=Chris HTTP/1.0 | |
HTTP/1.1 200 OK | |
Content-Type: text/html | |
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10) | |
Date: Sat, 13 Apr 2013 00:07:11 GMT | |
Content-Length: 18 | |
Connection: close | |
Your name is Chris |
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 'rack' | |
Rack::Server.start( | |
:app => proc {|rack| | |
request = Rack::Request.new(rack) | |
result = "Your name is %s" % request["name"] | |
[ 200, {'Content-Type' => 'text/html'}, [result] ] | |
}, | |
:server => 'webrick' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment