The five-line sinatra app on http://www.sinatrarb.com/ is pretty damn impressive:
require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end
I can do four lines better than that, though:
require 'sinatra'
So what does that get you?
batkin:cholla ben$ ruby -rubygems cholla.rb == Sinatra/0.9.0.4 has taken the stage on 4567 for development with backup from Thin >> Thin web server (v1.0.0 codename That's What She Said) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4567, CTRL+C to stop 127.0.0.1 - - [03/May/2009 10:13:46] "GET /index.html HTTP/1.1" 200 7 0.0019
A basic http file server, perfect for working with plain html, javascript, and CSS! Just create a public/ directory alongside the one-line sinatra app, and have at it! If you create an index.html file in public/, it will be served up when you go to http://localhost:4567/. Try it!
Once you decide to add some server-side code, you can simply go in to the sinatra app and add it.