Tuesday, May 10, 2016

[Fixed] WARN Not all child routes satisfy compojure.api.routing/Routing. {:path nil, :method nil}, invalid child routes:

I had this error in my client app that uses compojure-api. The cause of this problem is that I put the static assets routing configuration in the wrong place. We put (route/resources "/") inside defapi which is a place for api routing configurations. So to fix this, we create a defroutes for static assets routing config and merge this defroutes with defapi before giving it to webserver as a ring handler. At the end, the code look something like this.

(ns my.namespace
  (:require [compojure.api.sweet :refer [defapi]]
            [compojure.core :refer [defroutes routes]]
            [compojure.route :as route]))

(defapi app

(defroutes site
  (route/resources "/"))

(defn handler []
  (route site app))

No comments:

Useful commands for observe running JVM process

$ jcmd List running processes $ jinfo  Get details of a process $ jps -lvm List running processes with params