diff --git a/examples/frontend/project.clj b/examples/frontend/project.clj index 62d4cfc3f..8416bc0ae 100644 --- a/examples/frontend/project.clj +++ b/examples/frontend/project.clj @@ -51,4 +51,5 @@ :figwheel {:http-server-root "public" :server-port 3449 - :nrepl-port 7002}) + :nrepl-port 7002 + :ring-handler backend.server/handler}) diff --git a/examples/frontend/resources/public/index.html b/examples/frontend/resources/public/index.html index bbad514ce..ce1dd45b8 100644 --- a/examples/frontend/resources/public/index.html +++ b/examples/frontend/resources/public/index.html @@ -5,6 +5,6 @@
- + diff --git a/examples/frontend/src/backend/server.clj b/examples/frontend/src/backend/server.clj new file mode 100644 index 000000000..88171cfa1 --- /dev/null +++ b/examples/frontend/src/backend/server.clj @@ -0,0 +1,11 @@ +(ns backend.server + (:require [clojure.java.io :as io] + [ring.util.response :as resp] + [ring.middleware.content-type :as content-type])) + +(def handler + (-> (fn [request] + (or (resp/resource-response (:uri request) {:root "public"}) + (-> (resp/resource-response "index.html" {:root "public"}) + (resp/content-type "text/html")))) + content-type/wrap-content-type)) diff --git a/modules/reitit-frontend/src/reitit/frontend/history.cljs b/modules/reitit-frontend/src/reitit/frontend/history.cljs index 98d40b0ad..968811406 100644 --- a/modules/reitit-frontend/src/reitit/frontend/history.cljs +++ b/modules/reitit-frontend/src/reitit/frontend/history.cljs @@ -96,7 +96,8 @@ (gevents/unlistenByKey listen-key) (gevents/unlistenByKey click-listen-key)) (-get-path [this] - (.. js/window -location -pathname)) + (str (.. js/window -location -pathname) + (.. js/window -location -search))) (-href [this path] path))