2017-04-05 22:13:59 +00:00
|
|
|
# server.rb
|
|
|
|
require 'sinatra'
|
|
|
|
require 'htmlentities'
|
|
|
|
|
|
|
|
get '/' do
|
|
|
|
`cd ..; echo "(display (html-wrap (cookbook-as-html cookbook)))" | petite -q "batch.scm"`
|
|
|
|
end
|
|
|
|
|
2017-04-05 22:22:37 +00:00
|
|
|
get '/ingredient/:ingredient' do
|
2017-04-05 22:13:59 +00:00
|
|
|
ingredient = HTMLEntities.new.decode params['ingredient']
|
|
|
|
`cd ..; echo "(display (html-wrap (cookbook-as-html (recipes-by-ingredients cookbook '(\\"#{ingredient}\\")))))" | petite -q "batch.scm"`
|
|
|
|
end
|
2017-04-05 22:22:37 +00:00
|
|
|
|
|
|
|
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
|