git.fiddlerwoaroof.com
Browse code

feature: add routes generic function for declaring routes

Ed Langley authored on 12/09/2019 01:17:56
Showing 2 changed files
... ...
@@ -16,6 +16,12 @@
16 16
                    renders the model picked out by the controller. Normally, this is
17 17
                    specialized using the DEFINE-VIEW macr"))
18 18
 
19
+(defgeneric routes (app)
20
+  (:method-combination progn)
21
+  (:method :around (app)
22
+    (call-next-method)
23
+    app))
24
+
19 25
 (defmacro defroutes (app &body routes)
20 26
   "Define a set of routes for given paths. the ROUTES parameter expects this format:
21 27
    ((\"/path/to/{route}\" :method :POST) route-callback) the AS-ROUTE macro helps one
... ...
@@ -5,7 +5,8 @@
5 5
   (:export #:defroutes  #:as-route  #:define-controller #:define-view    
6 6
            #:controller #:view      #:run-route #:mustache-view    
7 7
            #:render-mustache        #:define-spinneret-view
8
-           #:setf1      #:call-current-view))
8
+           #:setf1      #:call-current-view
9
+           #:routes))
9 10
 
10 11
 (defpackage #:araneus-2
11 12
   (:use #:cl #:fw.lu)