mirror of
https://github.com/sigmasternchen/shochu
synced 2025-03-15 07:38:55 +00:00
incorporated templates into demo
This commit is contained in:
parent
43fe094fac
commit
0575c9c692
2 changed files with 21 additions and 2 deletions
10
demo.sh
10
demo.sh
|
@ -3,17 +3,23 @@
|
|||
. base.sh
|
||||
. mysql.sh
|
||||
. credentials.sh
|
||||
. shinden/engine.sh
|
||||
|
||||
connect "$mysqlHost" "$mysqlUser" "$mysqlPassword" "$mysqlDB"
|
||||
|
||||
route GET / index
|
||||
index() {
|
||||
header "Content-Type" "text/html"
|
||||
endHeaders
|
||||
|
||||
echo "Users:"
|
||||
echo "SELECT * FROM users" | query | getColumns 2
|
||||
title="Test"
|
||||
users=($(echo "SELECT * FROM users" | query | getColumns 2))
|
||||
|
||||
template "templates/demo.html.templ" ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
route GET /debug debug
|
||||
debug() {
|
||||
endHeaders
|
||||
|
|
13
templates/demo.html.templ
Normal file
13
templates/demo.html.templ
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ print "$title" }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
{{ for user in "${users[@]}"; do }}
|
||||
<li>{{ print "$user" }}</li>
|
||||
{{ done }}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue