ec06b36df0
Why? I dunno. I think it looks cool.
70 lines
1.8 KiB
Common Lisp
70 lines
1.8 KiB
Common Lisp
(in-package #:cl-user)
|
|
|
|
(defpackage #:live-chat-db
|
|
(:use #:cl)
|
|
(:local-nicknames (#:cl-dbi #:dbi))
|
|
(:export #:*db*
|
|
#:open-database
|
|
#:close-database
|
|
#:create-messages-table
|
|
#:insert-message
|
|
#:fetch-messages
|
|
#:clear-messages))
|
|
|
|
(defpackage #:live-chat-ui
|
|
(:use #:cl)
|
|
(:local-nicknames (#:cl-who #:cl-who))
|
|
(:import-from #:live-chat-db
|
|
#:insert-message
|
|
#:fetch-messages)
|
|
(:export #:set-subpath-prefix
|
|
#:generate-html-message
|
|
#:render-chat-messages
|
|
#:render-chat-ui
|
|
#:*messages*))
|
|
|
|
(defpackage #:live-chat-cgi
|
|
(:use #:cl)
|
|
(:import-from #:live-chat-ui)
|
|
(:export #:cgi-handler))
|
|
|
|
(defpackage #:live-chat-ws
|
|
(:use #:cl)
|
|
(:import-from #:live-chat-ui
|
|
#:generate-html-message)
|
|
(:import-from #:websocket-driver
|
|
#:make-client
|
|
#:make-server
|
|
#:on
|
|
#:send
|
|
#:start-connection
|
|
#:close-connection)
|
|
(:export #:make-websocket-server
|
|
#:handle-close-connection
|
|
#:handle-post-message
|
|
#:broadcast-to-room
|
|
#:handle-new-connection
|
|
#:*connections*))
|
|
|
|
(defpackage #:live-chat-routes
|
|
(:use #:cl)
|
|
(:import-from #:live-chat-db
|
|
#:insert-message)
|
|
(:import-from #:live-chat-ws
|
|
#:handle-post-message)
|
|
(:import-from #:live-chat-ui
|
|
#:render-chat-messages
|
|
#:render-chat-ui)
|
|
(:local-nicknames (#:cl-who #:cl-who)
|
|
(#:myway #:myway))
|
|
(:export #:app))
|
|
|
|
(uiop:define-package #:live-chat
|
|
(:use #:cl)
|
|
(:import-from #:clack #:clackup)
|
|
(:use-reexport #:live-chat-ui
|
|
#:live-chat-db
|
|
#:live-chat-routes))
|
|
|
|
(in-package #:live-chat)
|