1 Sinatra (C) 2007 By Blake Mizerany
3 = Classy web-development dressed in a DSL
7 sudo gem install sinatra -y
11 I'm going to move quick. I'll let you drool at your own pace.
13 - Create a file called lyrics.rb (or any name you like)
19 - Run (yes, with just ruby)
21 == Sinata has taken the stage on port 4567!
23 - Take a moment and view the default page http://localhost:4567. Go ahead and bask in it's glory.
26 * It didn't create any page to show you that default page (just a cool thing to see, that's all)
27 * There was nothing generated other than a log file
28 * Sinatra is a really cool name for a web-framework that's a DSL
30 - Modify lyrics.rb by adding:
36 - Refresh (no need to restart Sinatra):
40 - Modify again (then refresh):
44 <form action='/' method="POST">
45 <input type="text" name="name" />
46 <input type="submit" value="Say my name!" />
52 "Hello #{params[:name] || 'World'}!"
57 Use the Sinatra::Erb::EventContext or Sinatra::Haml::EventContext to do the same. Do them inline and as template files.