git.fiddlerwoaroof.com
Raw Blame History
(in-package :fwoar.rss-reader)

(defgeneric app (obj)
  (:documentation "the ningle app that is to be run"))

(defgeneric handler (obj)
  (:documentation "the clack handler representing the currently running application"))

(defclass+ rss-reader ()
  ((%app :initform (make-instance 'ningle:<app>)
         :reader app)
   (%handler :accessor handler))
  (:documentation
   "A simple wrapper that ties a ningle app to a clack handler"))

(defmethod araneus:routes progn ((app rss-reader))
  (araneus:defroutes (app app)
    (("/") (serapeum:partial 'araneus:run-route (make-instance 'homepage)))
    (("/other") (serapeum:partial 'araneus:run-route 'other))))

(defun start (app)
  (setf (handler app)
        (clack:clackup (app app)))
  app)

(defun main ()
  (start (araneus:routes (rss-reader))))