If your client is served from the backend (instead of a separate web-server or 
proxy), could you examine the path of the script itself and parse for the first 
part as context?

Something like:

(def context
  (or (-> (.. js/document -location -pathname) (s/split #"/") second)
      ""))

Given “/context/main.js” you’d get “context”. Maybe a conditional to check if 
the context is the name of the script itself (main.js).

Would that work in your case?

> On May 27, 2015, at 8:01 PM, Colin Yates <[email protected]> wrote:
> 
> I am using the excellent sente which needs to know what the URL for the 
> server side end point is. Most examples simply define "/chsk" but this 
> doesn't work if there is a context root.
> 
> For example, if my web app's index root is "/abc" then I need to specify 
> "/abc/chsk" in the clojurescript.
> 
> Are there any neat tricks for determining the context root in the 
> clojurescript environment (I guess not) or any way to parameterise my 
> clojurescript outside of lein?
> 
> Thanks!
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to