clojureringcompojurewebjarslib-noir

How do I add webjars resources to lib-noir's app-handler?


How do I add webjars resources to lib-noir's app-handler?

I used to do this only using Ring like this:

(def app
  (-> handler
      (wrap-resource "public")
      (wrap-resource "/META-INF/resources")
      ;;resources from webjars
      ))

Now I'm trying to figure out how to do this with lib-noir.

I tried this:

(def app (noir-middleware/app-handler [home-routes app-routes]
                                      :ring-defaults {:static
                                                      {:resources
                                                       "/META-INF/resources"}}))

and it works, but I get a problem when posting forms after configuring this. The params are empty in the ring request now.


Solution

  • This seems to do it:

    (defroutes app-routes
      (route/resources "/")
      (route/resources "/" {:root "META-INF/resources/"})
      (route/not-found "Not Found"))