# server.rb require 'sinatra' require 'htmlentities' get '/' do `cd ..; echo "(display (html-wrap (cookbook-as-html cookbook)))" | petite -q "batch.scm"` end get '/ingredient/:ingredient' do ingredient = HTMLEntities.new.decode params['ingredient'] `cd ..; echo "(display (html-wrap (cookbook-as-html (recipes-by-ingredients cookbook '(\\"#{ingredient}\\")))))" | petite -q "batch.scm"` end get '/recipe/:title' do title = HTMLEntities.new.decode params['title'] `cd ..; echo "(display (html-wrap (recipe-as-html (recipe-by-name cookbook \\"#{title}\\"))))" | petite -q "batch.scm"` end