2022-01-13 21:32:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
route GET "/" home
|
|
|
|
home() {
|
|
|
|
htmlContent
|
|
|
|
endHeaders
|
|
|
|
|
|
|
|
title="Home"
|
|
|
|
content="$(template "templates/home.fragment.templ")"
|
|
|
|
template "templates/layout.html.templ"
|
|
|
|
}
|
2022-03-30 20:43:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
route GET "/recipe" recipe
|
|
|
|
recipe() {
|
|
|
|
id="$(queryString "id")"
|
|
|
|
|
|
|
|
result="$(getRecipeById "$id")"
|
|
|
|
|
|
|
|
if test -z "$result"; then
|
|
|
|
"$_404"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
htmlContent
|
|
|
|
endHeaders
|
|
|
|
|
|
|
|
name="$(echo "$result" | head -n 1 | getColumns 1)"
|
|
|
|
description="$(echo "$result" | head -n 1 | getColumns 2)"
|
|
|
|
uid="$(echo "$result" | head -n 1 | getColumns 5)"
|
|
|
|
author="$(echo "$result" | head -n 1 | getColumns 6)"
|
|
|
|
qts="$(echo "$result" | getColumns 4)"
|
|
|
|
ingredients="$(echo "$result" | getColumns 3)"
|
|
|
|
nrIngredients="$(echo "$qts" | wc -l)"
|
|
|
|
|
2022-03-31 19:00:39 +00:00
|
|
|
tags="$(getTagsByRecipeId "$id" | getColumns 1)"
|
|
|
|
|
|
|
|
title="$name"
|
2022-03-30 20:43:32 +00:00
|
|
|
content="$(template "templates/recipe.fragment.templ")"
|
|
|
|
template "templates/layout.html.templ"
|
|
|
|
}
|