From 4c0ad819d72b9730d1867cceecdb6c84cfdc2f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Thu, 6 Apr 2017 00:13:59 +0200 Subject: [PATCH] add simple Ruby-based webserver to present recipes --- web/server.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 web/server.rb 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