I'm developing a REST API for RESTAS, trying to segregate functionally related parts in RESTAS modules.
I would like the "top-level" module to provide an navigable interface to its mounted modules computed from URL upon which these modules are mounted.
The problem I am running into is that RESTAS:GENURL (or RESTAS:GENURL*) doesn't include the path that the module is mounted on, nor can I see an easy way to concatenate things based on the package and symbol that designates a RESTAS:DEFINE-ROUTE.
Is there a way I can get the path upon which a module is mounted somehow included in dynamic URL generation?
(restas:define-module #:rest.index (:use #:cl)) ;; the top-level index of the API
(restas:define-module #:rest.scan (:use #:cl)) ;; a sub-module to mount in the API
(in-package #:rest.scan)
(restas:define-route %index ("")
(who:with-html-output-to-string (o)
(:html
(:body
(:p "Index of scan API")))))
(in-package #:rest.index)
(restas:define-route %index ("")
(who:with-html-output-to-string (o)
(:html
(:body
(:h1 "Scanned Documents API")
(:p ((:a :href "/scan/" ;; (restas:genurl 'rest.scan::%index) --> "/". I want to somehow generate "/scan/" from the symbol
)
"INDEX"))))))
(restas:mount-module -scan- (#:rest.scan)
(:url "/scan/"))
#|
(restas:start '#:rest.index)
|#