changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/web/dash.lisp

changeset 664: 4d8451fe5423
parent: lisp/web/dash.lisp@386d51cf61ca
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 22 Sep 2024 01:02:49 -0400
permissions: -rw-r--r--
description: moved web to lib/web, added dat/css
1 ;;; web/dash.lisp --- local user dashboard
2 
3 ;;; Code:
4 (uiop:define-package :web/dash
5  (:use :cl :std #+nil :lass #+nil :spinneret :cli/clap)
6  ;; (:import-from :clack :clackup)
7  (:export
8  :main
9  :serve-static-assets
10  :*web-dash-port*))
11 
12 (in-package :web/dash)
13 
14 (defparameter *web-dash-port* 8800)
15 (defparameter *web-dash-static-directory* #P"/tmp/web/dash/static/")
16 
17 (defvar *server*)
18 
19 (defun main (&key (output *standard-output*) (port *web-dash-port*))
20  (let ((*standard-output* output))
21  (print "starting dash server on ~A" port)
22  (handler-case (sb-thread:join-thread (find-if (lambda (th)
23  (search "hunchentoot" (sb-thread:thread-name th)))
24  (sb-thread:list-all-threads)))
25  ;; Catch a user's C-c
26  (#+sbcl sb-sys:interactive-interrupt
27  () (progn
28  (format *error-output* "Aborting.~&")
29  ;; (clack:stop *server*)
30  (uiop:quit)))
31  (error (c) (format t "Woops, an unknown error occured:~&~a~&" c)))))