Skip to content

Instantly share code, notes, and snippets.

@cheald
Created April 13, 2013 00:07
Show Gist options
  • Save cheald/5376153 to your computer and use it in GitHub Desktop.
Save cheald/5376153 to your computer and use it in GitHub Desktop.
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
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