Closed alehatsman closed 6 years ago
I found that i can pass not-found function. And that function is actually a proxy to real server. So now i use serve task only for static files and everything else goes throw not-fund function.
Proxy handler:
(ns app.dev
(:require [aleph.http :as http]
[app.config :as config]))
(defn handler
"This handler used in boot serve task.
It proxies all requests for dynamic content to real backend."
[req]
@(http/get (format "http://localhost:%s%s" (config/get-port) (:uri req))))
Config:
(deftask start
"The `run` task wraps the building of your application in some
useful tools for local development: an http server, a file watcher
a ClojureScript REPL and a hot reloading mechanism"
[]
(comp (backend-dev)
(serve :dir "resources/public" :not-found 'app.dev/handler)
(watch)
(cljs-repl)
(cljs-devtools)
(dirac)
(reload)
(build-frontend)))
Hi, i use aleph server as backend.
I have a few questions, first one is, if i pass my own ring handler, how can i serve files from build pipeline, if boot store files in temp folders...?
Because of the first problem i decided ok, let's use your implementation, how can i proxy all non static files requests to my real backend? I also can't. Because for that i need to pass ring handler. And if i pass it, i can't serve static files from build pipeline.
I am in few steps of throwing all my boot configuration to trash and rewriting it in lein.
What options can u suggest ?
Thank you.