Fork me on GitHub

From what I understand, using absolute paths, or "lobalhost:port" is bad practice in production. Is there an example how do I make my re-frame app use relative paths for my api? e.g instead of: (fun-with-api "") or (fun-with-api "http://localhost:1234/api/fun") I could do something like (fun-with-api "/api/fun")


What is "re-frame pp"?


Typo of app I suspect


If so, then the question in the OP is answered by the OP. Yes, you just use something like "/api/fun".


Oh, thats good to know, thanks 🙂 I realize I didn't define my problem correctly, I need to connect to a backend websocket api on the same server, the solution may be: a. using a url variable in a config file b. using (. (. js/window -location) -host) :)

Jag Gunawardana23:03:15

I have used the js/window solution before, but then I moved things into containers and broke it all. To keep it flexible I put env specific configuration into environment vars and in my http://nginx.conf I serve an endpoint there. That way I can setup an endpoint in my reframe for /server that in dev serves a hard coded file, but in staging or prod serves something based on the end var eg API_ENDPOINT. Can post an example if it helps.

👍 4