Fork me on GitHub
#yada
<
2019-03-01
>
Pavel Klavík13:03:39

hi, I am trying to get working server reloading with yada and mount whenever code changes. I am using yada listener example from user guide:

(defn create-server []
  (yada/listener
    ["/"
     [["" (yada/as-resource "Root")]
      ["hello" (yada/as-resource "Goodbye World!")]
      ["test" (yada/resource {:produces "text/plain"
                           :response "This is a test!"})]
      [true (yada/as-resource nil)]]]
    {:port port}))

(mount/defstate
            server
            :start (create-server)
            :stop ((:close server)))

Pavel Klavík23:03:04

if I want to serve html together with js and css files for a given route path, I tried to use (yada/as-resource ( "index.html")) but it does not loads subresources. What is the easiest way to load them as well?

Pavel Klavík23:03:35

found the solution (yada.resources.classpath-resource/new-classpath-resource "public")

Pavel Klavík23:03:08

but this

(yada.resources.classpath-resource/new-classpath-resource
              "public" {:index-files ["index.html"]})
does not seem to work for localhost:3000, I get 405.

Pavel Klavík23:03:04

maybe the problem is with Windows