Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Last active December 18, 2015 17:19
Show Gist options
  • Save ashleygwilliams/5818034 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/5818034 to your computer and use it in GitHub Desktop.
a simple exercise to explore the code required to run a simple local helloworld rack app
require 'rack'
class MyApp #change this name
def call(env)
#some code goes here!
end
end
Rack::Handler::WEBrick.run(MyApp.new, {:Port => 3000}) #you'll need to update this...

HELLO RACK!

OBJECTIVES:

1   get a rack application running locally
2   get to know the basic moving parts of the simplest rack app

INSTRUCTIONS:

first read this: http://whatcodecraves.com/articles/2012/07/23/ruby-on-rack

then... the app below is based on the example in the tutorial. to get the app running type 'ruby hellorack.rb' in terminal

complete the following steps to explore the different parts of this simple application:

1   rename the class to your name, e.g. AshleyApp
2   define the call method 
3   print your name to the screen, e.g. Hello Ashley
4   make your name a h1 heading
5   change the color of your name to pink and link it to your student page
6   make the app run on a port different from 3000

post your solution as a gist in piazza

@stevenabrooks
Copy link

no clue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment