14 lines
406 B
Ruby
14 lines
406 B
Ruby
# 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
|