add simple Ruby-based webserver to present recipes

This commit is contained in:
Christoffer Müller Madsen 2017-04-06 00:13:59 +02:00
parent cc3cd7c19f
commit 4c0ad819d7

13
web/server.rb Normal file
View File

@ -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