I really am dense at times. :(
I was confusing the 'component' for the system map in this
line:
https://github.com/weavejester/duct/blob/master/duct/src/duct/component/endpoint.clj#L6
#PalmToFace
-d
On Tuesday, June 9, 2015 at 5:57:48 PM UTC-5, James Reeves wrote:
>
> On 9 June 2015 at 23:16,
On 9 June 2015 at 23:16, Dru Sellers wrote:
> @James do you only have one component that has all of your routes? or do
> you have each component supply its own routes? If you imagine a component
> providing its own routes, I'd love to see a duct example with two routes
> set up.
>
> I believe tha
@James do you only have one component that has all of your routes? or do
you have each component supply its own routes? If you imagine a component
providing its own routes, I'd love to see a duct example with two routes
set up.
I believe that would be multiple endpoint components.
Looking
at
I think the most important rule when using component is to only use local
state like Timothy stated, i.e. nothings gets def-ed. You could write an
application that a -main function that starts the system and you would
never need a global reference to the system.
In practise however, you do make re
On Tue, Jun 9, 2015 at 6:12 AM, Timothy Baldridge
wrote:
> Stuart addresses two anti-patterns in your PRs. Perhaps I can help explain
> them.
>
> Let's say we have a system that looks like this:
>
> (defrecord DBConnection [])
>
> (defrecord DBLayer [db-connection])
>
> (defrecord AppLayer [db-la
Stuart addresses two anti-patterns in your PRs. Perhaps I can help explain
them.
Let's say we have a system that looks like this:
(defrecord DBConnection [])
(defrecord DBLayer [db-connection])
(defrecord AppLayer [db-layer])
We can construct a system thusly:
{:db-connection (->DBConnection .
My recommendation is to use a closure. So I'd write your example as:
(defn username-endpoint [{:keys [db]}]
(routes
(GET "/:username" [username]
(let [user (users/get-user db username)]
(str "Hello " (:name user) "")
So you pass your configuration map into the endpoint functi
Hey Dru
Take a look at Duct: https://github.com/weavejester/duct
If you make a new app using that template, you should get some
pointers from the boilerplate it generates.
cheers,
Jonathan
On Mon, Jun 8, 2015 at 5:51 PM, Dru Sellers wrote:
> So, I guess I am a bit lost, how does someone actual
So, I guess I am a bit lost, how does someone actually use component? I
have an application all set up with it and it seems to be working as I
would expect but Stuart seems to be steering me in a different direction.
https://github.com/stuartsierra/component/pull/35
https://github.com/stuartsierr