fixed djula

This commit is contained in:
2026-08-05 01:08:49 +03:00
parent beb31a232a
commit e8372bdb42
4 changed files with 40 additions and 2 deletions
+27
View File
@@ -5,3 +5,30 @@
collect (list i
(format nil "Product nb ~a" i)
9.99)))
(defvar *server* nil
"Server instance (Hunchentoot acceptor).")
(defparameter *port* 8899 "The application port.")
(defparameter *template-root* "
<title> Lisp web app </title>
<body>
hello app
</body>
")
(defroute root ("/" :method :get) ()
(djula:render-template*
(djula:compile-string *template-root*)
nil))
(defun start-server (&key (port *port*))
(format t "~&Starting the web server on port ~a~&" port)
(force-output)
(setf *server* (make-instance 'easy-routes:easy-routes-acceptor
:port port))
(hunchentoot:start *server*))
(defun stop-server (&optional (server *server*))
(hunchentoot:stop server))