;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package #:live-chat-routes) ;; Define a app for routing (defparameter *app* (make-instance 'ningle:app)) ;; Route to render the chat UI (setf (ningle:route *app* "/" :method :GET) #'(lambda (params) (declare (ignore params)) (live-chat-ui:render-chat-ui)) ;; Route for chat messages (ningle:route *app* "/chat-messages" :method :GET) #'(lambda (params) (declare (ignore params)) (live-chat-ui:render-chat-messages)) ;; Route for posting messages (ningle:route *app* "/post-message" :method :POST) #'(lambda (params) (let ((message (cdr (assoc "message" params :test 'equal)))) (when (and message (not (string= message ""))) (live-chat-ws:handle-post-message message))) (live-chat-ui:render-chat-messages)))