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
+9
View File
@@ -1 +1,10 @@
Following the tutorial [[https://web-apps-in-lisp.github.io/][here]] by vindarel. Following the tutorial [[https://web-apps-in-lisp.github.io/][here]] by vindarel.
* djula fix
Loading error due to sbcl incompat with named-readtables.
- [[https://bugs.launchpad.net/sbcl/+bug/2134500]]
- [[https://github.com/melisgl/named-readtables/commit/6eea56674442b884a4fee6ede4c8aad63541aa5b]]
Applying this fixed it.
+3 -1
View File
@@ -1,2 +1,4 @@
(defpackage :web-apps (defpackage :web-apps
(:use :cl)) (:use :cl)
(:import-from :easy-routes
:defroute))
+27
View File
@@ -5,3 +5,30 @@
collect (list i collect (list i
(format nil "Product nb ~a" i) (format nil "Product nb ~a" i)
9.99))) 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))
+1 -1
View File
@@ -2,7 +2,7 @@
(defsystem "web-apps" (defsystem "web-apps"
:license "WTFPL" :license "WTFPL"
:depends-on ("hunchentoot" "easy-routes") :depends-on ("hunchentoot" "easy-routes" "djula")
:components :components
((:module "src" ((:module "src"
:components ((:file "package") :components ((:file "package")