Fork me on GitHub
#integrant
<
2021-12-07
>
Noah Bogart20:12:10

when using integrant with a server built using ring middleware/handlers, is it idiomatic to assoc the entire component on each request so every handler has access to it? right now I’m only assoc’ing the database connection, but as I move more things out of global atoms and into the component, I’m finding I need access to more and more. Seems like a lot of work just in case, but also feels like a burden on development to have to add individual elements one at a time as I find need for them

weavejester22:12:52

What do you mean by the “entire component”. I generally assign each route handler to a key, and then give the handler the dependencies needed.

👍 1
Noah Bogart00:12:43

That’s very interesting! Thanks for the idea

Noah Bogart20:12:44

In the current case, the global atom holds which server mode we’re in (`"dev"` or "prod") which we use in cljs rendering. On the one hand, doesn’t feel ridiculous to keep around, but on the other, globals 😬