Fork me on GitHub
#luminus
<
2020-07-21
>
theequalizer7321:07:41

Hi folks, how should I write this route in Luminus (reitit) on routes/home.clj>

(GET "/:slug" [slug]
    (render-wiki-page {:title "The title" :body "The body" :uri-slug slug}))

okwori04:07:56

Not sure what render-wiki-page looks like internally but maybe this might help...

(defn home-routes []
  [""
   {:middleware [middleware/wrap-csrf
                 middleware/wrap-formats]
    :conflicting true}
   [""
    ["/" {:get (fn [request] (layout/render request "home.html"))}]
    ["/:slug" {:get (fn [{{:keys [slug]} :path-params :as request}]
                      (let [title "The title" body "The body" uri-slug slug]
                        (layout/render request
                                       "wiki.html"
                                       {:title title :body body :uri-slug uri-slug})))}]
    ["/graphiql" {:get (fn [request] (layout/render request "graphiql.html"))}]]])

sharkdance 3
theequalizer7312:07:51

I will try that, thank you very much! 🙂

3