I am not a web programmer and I am still learning about rack. I know how to work the simplest lobster example that just uses call(env) and returns a bunch of HTML.
How do I use javascript and css with this? Where do I put my .js and .css files? And for that matter where do I put my image .jpg files?
I think that main purpose of rack is handling of HTTP requests. Rack has handlers that allow it to connect to all web application servers (WEBrick, Mongrel etc.) But handling of static types of content – js, css, pictures – is the aim of web servers. One of the Rack’s purposes – is to be a bridge between servers and Ruby web frameworks (Rails, Sinatra etc.)
UPDATE
If you want to handle static file with rack’s help, you can use Rack::Static class. For example, I have following folder structure:
/my_rack_folder
|_ config.ru
|_ my_app.rb
|_/media
|_test
and test – static file. Now you can run rack using rackup
rackup config.ru– by default it start on port 9292 with WEBrick server. If you open your browser by addresslocalhost:9292, you will see text rendered by my_app.rb file, and by addresslocalhost:9292/media/test– content your static file.