Skip to content

Instantly share code, notes, and snippets.

@joshkh
Forked from madstap/SPA-routing.cljc
Created June 14, 2017 09:17
Show Gist options
  • Save joshkh/4962ed419dab45ea34cd2d68078fb81d to your computer and use it in GitHub Desktop.
Save joshkh/4962ed419dab45ea34cd2d68078fb81d to your computer and use it in GitHub Desktop.
;; In core.cljs
(ns foo.core
(:require
[pushy.core :as pushy]
[re-frame.core :as rf]]))
(defn routing! []
(pushy/start! (pushy/pushy #(rf/dispatch [:routes/set-page %]) routes/match)))
(defn ^:export init []
(rf/dispatch-sync [:initialize-db])
(dev-setup)
(routing!)
(mount-root))
;; In handler.clj
(ns foo.handler
(:require
[compojure.core :refer [ANY defroutes]]
[compojure.route :refer [resources]]
[ring.util.response :refer [resource-response]]]))
(defroutes routes
(ANY "*" [] (resource-response "index.html" {:root "public"}))
(resources "/"))
(def handler routes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment