diff --git a/web/server.rb b/web/server.rb new file mode 100644 index 0000000..747652b --- /dev/null +++ b/web/server.rb @@ -0,0 +1,13 @@ +# 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