render-products
This commit is contained in:
+11
-3
@@ -14,14 +14,22 @@
|
|||||||
(defparameter *template-root* "
|
(defparameter *template-root* "
|
||||||
<title> Lisp web app </title>
|
<title> Lisp web app </title>
|
||||||
<body>
|
<body>
|
||||||
hello app
|
<ul>
|
||||||
|
{% for product in products %}
|
||||||
|
<li> {{ product.1 }} - {{ product.2 }} </li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
")
|
")
|
||||||
|
|
||||||
(defroute root ("/" :method :get) ()
|
(defun render-products ()
|
||||||
(djula:render-template*
|
(djula:render-template*
|
||||||
(djula:compile-string *template-root*)
|
(djula:compile-string *template-root*)
|
||||||
nil))
|
nil
|
||||||
|
:products (products)))
|
||||||
|
|
||||||
|
(defroute root ("/" :method :get) ()
|
||||||
|
(render-products))
|
||||||
|
|
||||||
(defun start-server (&key (port *port*))
|
(defun start-server (&key (port *port*))
|
||||||
(format t "~&Starting the web server on port ~a~&" port)
|
(format t "~&Starting the web server on port ~a~&" port)
|
||||||
|
|||||||
Reference in New Issue
Block a user