Skip to content

Instantly share code, notes, and snippets.

@theronic
Created March 8, 2016 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theronic/012aa87329eeadbba3ee to your computer and use it in GitHub Desktop.
Save theronic/012aa87329eeadbba3ee to your computer and use it in GitHub Desktop.
Cannot get boot-http :not-found handler to work when running `boot dev`
(set-env!
:source-paths #{"src/cljs" "src/clj"}
:resource-paths #{"resources"}
:target-path "target"
:dependencies '[[org.clojure/clojure "1.7.0"]
[adzerk/boot-cljs "1.7.228-1" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[adzerk/boot-cljs-repl "0.3.0" :scope "test"]
[adzerk/boot-reload "0.4.5" :scope "test"]
[pandeiro/boot-http "0.7.3" :scope "test"]
[org.clojure/clojurescript "1.7.228"]
[crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT" :scope "test"]
[reagent "0.6.0-alpha"]
[cljs-ajax "0.5.3"]
[secretary "1.2.3"] ; todo remove
[bidi "1.25.1"]
[com.andrewmcveigh/cljs-time "0.4.0"]
[kibu/pushy "0.3.6"]
[cljsjs/moment "2.10.6-1"]
[re-frame "0.7.0-alpha"]
[adzerk/boot-template "1.0.0"]
[matchbox "0.0.8-SNAPSHOT"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
'[adzerk.boot-reload :refer [reload]]
'[pandeiro.boot-http :refer [serve]]
'[clojure.java.io :as io]
'[reps.server :refer [not-found-handler]])
(deftask build []
(comp (speak)
(cljs)))
(deftask run []
(comp (serve :not-found 'not-found-handler) ;; note this
(watch)
(cljs-repl)
(reload)
(build)))
(deftask production []
(task-options! cljs {:optimizations :advanced})
identity)
(deftask development []
(task-options! cljs {:optimizations :none :source-map true}
reload {:on-jsload 'web.app/mount})
identity)
(deftask prod []
(comp (production)
(cljs)))
(deftask dev
"Simple alias to run application in development mode"
[]
(comp (development)
(configure)
(run)))
(ns reps.server
(:require [ring.util.response :refer [file-response]]))
(defn not-found-handler [request]
(assoc-in
(file-response "target/index.html")
[:headers "Content-Type"]
"text/html;charset=utf8"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment