cookbook-dsl/web/server.rb

14 lines
406 B
Ruby
Raw Normal View History

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