From 401f4047291c0ad539d88b1e1baddcc667d0259a Mon Sep 17 00:00:00 2001 From: Mil Date: Thu, 10 Mar 2022 18:48:58 +0000 Subject: [PATCH] Serve static files from static/ And assume they're HTML. --- webshit.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webshit.lisp b/webshit.lisp index cd599ed..a36d840 100644 --- a/webshit.lisp +++ b/webshit.lisp @@ -211,6 +211,15 @@ (register-handler (mangle-path "/buckets/") 'serve-bucket) +;;; Static files + +(defun serve-file (env) ; This is dum + (if (uiop:file-exists-p (make-absolute (getf env :request-uri))) + (list 200 '(:content-type "text/html") (make-absolute (getf env :request-uri))) + (http-status 404))) + +(register-handler (mangle-path "/static/") 'serve-file) + ;;; server! (defun app (env)