Fork me on GitHub
#reagent
<
2017-01-25
>
artur10:01:48

Any pointers how to configure nginx to serve static index.html reagent app with router?

ejelome10:01:20

I think that's a totally separate concern, not reagent specific 🙂

ejelome10:01:06

afaik, you just put the js output compiled from cljs to that webserver, and that's it

artur10:01:53

I have a virtua host on nginx that points http://app.mydomain.com to that index.html and when I click a link on reagent app that directs to http://app.mydomain.com/room it works great. But when I open new browser window and enter http://app.mydomain.com/room I get 404

ejelome10:01:15

ahhh, I think going there directly is the problem because it's looking for a file or folder named room and where js is isn't really involved

pesterhazy10:01:04

@artur, you need to change you nginx configuration to handle all requests for /*, e.g. /room, with index.html

pesterhazy10:01:19

that's really an nginx question 🙂

artur10:01:04

Actually I had to do the following: location / { try_files $uri /index.html; } I know it is an nginx issue but I think this is quite related to reagent since docs mostly talk about running the server version of reagent.

artur10:01:15

But I managed to maek it work, thank you for your time 🙂

pesterhazy10:01:36

what is the "server version of reagent"?

richiardiandrea19:01:58

naming is hard 😄 suggestion on how to call a namespace that includes functions that accept the app-state and return things? state.clj is ugly

gadfly36120:01:03

@richiardiandrea Agreed, naming is definitely hard 😆 What kind of stuff is it returning?

richiardiandrea20:01:44

let's say I have resources in the state and I need to index them, I will a get-indexed-resources function

richiardiandrea20:01:12

I have a bunch of them and it is becoming unwieldy, in re-frame I'd call it db.clj probably

gadfly36120:01:08

Ahh gotcha, yeah, i see why naming it is murky. I have a file called model.cljs with my app-state, and another file called cursors.cljs with my cursors, but i dont do any kind of processing there like indexing, so cant draw on experience to help. Hopefully someone else will chime in with a good name :)