Skip to content

Instantly share code, notes, and snippets.

@joegiralt
Last active December 18, 2015 17:59
Show Gist options
  • Save joegiralt/5821999 to your computer and use it in GitHub Desktop.
Save joegiralt/5821999 to your computer and use it in GitHub Desktop.
How to set up the simplest rails rack.
require 'rack'
class JoeApp #change this name
def call(env)
puts env['PATH_INFO']
puts env['HTTP_ACCEPT']
body = '<a href="http://students.flatironschool.com/students/joegiralt.html"><font color="pink"><h1>Hello Joe!</h1></font></a>'
[200, {'Content-Type' => 'text/html'}, [body]]
# [200, {'Content-Type' => 'text/html'}, [<h1>Hello JOE!</h1>]]
end
end
Rack::Handler::WEBrick.run(JoeApp.new, {:Port => 3002}) #you'll need to update this...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment