I'm building a Compojure webapp composed of two Clojure project. The first one is a webapp to visualize some data, the second one is a more complex application which need to use the first one.
I want to be able to run both application at the same time with run-jetty from the second project. This would allow the second webapp to call the URL from the first one to get the visualization.
I'm using the context macro from Compojure, here are the routes for the second app:
(def second-project-main-routes
[
(context "/second" request
(GET "/viewsession" {session :session} (str session))
(GET "/resetsession" [] (reset-session))
... other routes here ...
(route/resources "/"))
])
(def second-all-routes
(concat second-project-main-routes
first-project-routes)
(def second-app
(-> (handler/site (apply routes second-all-routes))
(wrap-base-url)))
;; to comment when building the JAR:
(defonce second-server (run-jetty #'second-app {:join? false :port 8080}))
and here the routes for the first app:
(def first-project-routes
[(context "/first" request
(GET "/" [] (index-page))
(route/files "/" {:root (str (System/getProperty "user.dir") "/data/public")})
(route/resources "/"))])
I have two main.js files. One in firstproject/resources/public/js/app/main.js and one in secondproject/resources/public/js/app/main.js
When I browse the url localhost:8080/first/app/js/main.js I get the main.js of the second project. Why that?