mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 17:01:11 +00:00
Read query string in HTML5 router
This commit is contained in:
parent
0bd1b94274
commit
e42c309144
4 changed files with 16 additions and 3 deletions
|
|
@ -51,4 +51,5 @@
|
||||||
|
|
||||||
:figwheel {:http-server-root "public"
|
:figwheel {:http-server-root "public"
|
||||||
:server-port 3449
|
:server-port 3449
|
||||||
:nrepl-port 7002})
|
:nrepl-port 7002
|
||||||
|
:ring-handler backend.server/handler})
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="js/app.js"></script>
|
<script src="/js/app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
11
examples/frontend/src/backend/server.clj
Normal file
11
examples/frontend/src/backend/server.clj
Normal file
|
|
@ -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))
|
||||||
|
|
@ -96,7 +96,8 @@
|
||||||
(gevents/unlistenByKey listen-key)
|
(gevents/unlistenByKey listen-key)
|
||||||
(gevents/unlistenByKey click-listen-key))
|
(gevents/unlistenByKey click-listen-key))
|
||||||
(-get-path [this]
|
(-get-path [this]
|
||||||
(.. js/window -location -pathname))
|
(str (.. js/window -location -pathname)
|
||||||
|
(.. js/window -location -search)))
|
||||||
(-href [this path]
|
(-href [this path]
|
||||||
path))
|
path))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue