Ah, but my understanding is that the hoplon template itself does not work. 
Micha made a fix some time back to the handler wrapper order--it was 
backwards in the template, but can not himself release it to clojars.

>From the hoplon channel:
>
>
<https://clojurians.slack.com/team/levitanong>
levitanong <https://clojurians.slack.com/team/levitanong> *[*10:56 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454255777000425> @laforge49 
<https://clojurians.slack.com/team/laforge49>, @flyboarder 
<https://clojurians.slack.com/team/flyboarder>, I figured out what the 
problem was. It wasn’t with my code! (refresher: My problem is the thing 
with `*session*` not working as expected) Turns out the problematic bit was 
the handler, as generated by `lein new hoplon-castra`.

```(def app
  (-> app-routes
      (d/wrap-defaults d/api-defaults)
      (castra/wrap-castra-session "a 16-byte secret")
      (castra/wrap-castra 'thingy.api)))
```


If I rearrange it by moving the form up to the top like so:

```(def app
  (-> app-routes
      (castra/wrap-castra 'thingy.api)
      (d/wrap-defaults d/api-defaults)
      (castra/wrap-castra-session "a 16-byte secret")))
```


`*session*` suddenly works. Which is great, except I don’t exactly know why 
this is causing the screwup. Do you guys have any idea?(edited)
<https://clojurians.slack.com/team/flyboarder>
flyboarder <https://clojurians.slack.com/team/flyboarder> *[*10:58 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454255896000427> Could be 
something else interacting with session, in the stack
*[*10:58*]* <https://clojurians.slack.com/archives/hoplon/p1454255927000428>
 
I have all my Castra forms up top and wrap defaults last
<https://clojurians.slack.com/team/levitanong>
levitanong <https://clojurians.slack.com/team/levitanong> *[*10:58 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454255932000429> hmm
*[*10:58*]* <https://clojurians.slack.com/archives/hoplon/p1454255939000430>
 
thing is, when i apply that to the demos
*[*10:59*]* <https://clojurians.slack.com/archives/hoplon/p1454255944000431>
 
sessions stop working
*[*10:59*]* <https://clojurians.slack.com/archives/hoplon/p1454255954000432>
 
i mean, when i use the arrangement as in the hoplon castra template, the 
demo breaks
*[*10:59*]* <https://clojurians.slack.com/archives/hoplon/p1454255964000433>
 
specifically, castra-chat
<https://clojurians.slack.com/team/flyboarder>
flyboarder <https://clojurians.slack.com/team/flyboarder> *[*11:01 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454256070000434> That may 
be something we need to fix in the template, I'm not sure who usually works 
on that but I'm sure they are open to a PR
<https://clojurians.slack.com/team/levitanong>
levitanong <https://clojurians.slack.com/team/levitanong> *[*11:12 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454256735000435> @flyboarder 
<https://clojurians.slack.com/team/flyboarder>: Do you think I should file 
an issue somewhere, like the hoplon castra repo? After all, you seem to 
think the order shouldn’t matter much. Or perhaps I should tag micha or 
alan?
<https://clojurians.slack.com/team/micha>
micha <https://clojurians.slack.com/team/micha> *[*11:27 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257643000436> hello
*[*11:28*]* <https://clojurians.slack.com/archives/hoplon/p1454257701000437>
 
@levitanong <https://clojurians.slack.com/team/levitanong>: the order in 
which middleware are applied definitely matters
<https://clojurians.slack.com/team/laforge49>
laforge49 <https://clojurians.slack.com/team/laforge49> *[*11:28 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257708000438> On advice 
from micha,, I have this which works:
 (-> app-routes
     (castra/wrap-castra
       'castra-notify-chat.chat-api
       'castra-notify-chat.user-api
       'notify.notification-api)
     (castra/wrap-castra-session "a 16-byte secret")
     (d/wrap-defaults d/api-defaults)))
So like @flyboarder <https://clojurians.slack.com/team/flyboarder> I have 
defaults on the bottom. And like @levitanong 
<https://clojurians.slack.com/team/levitanong> 's arrangement that works, I 
have wrap castra thingie on top.
The actual problem is that the template is backwards because -> reverses 
the order.
<https://clojurians.slack.com/team/micha>
micha <https://clojurians.slack.com/team/micha> *[*11:28 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257726000439> because 
it's a pipeline, each layer adding information for the subsequent layers to 
use
*[*11:29*]* <https://clojurians.slack.com/archives/hoplon/p1454257780000440>
 

```(-> foo bar baz) ; is the same as:
(baz (bar foo))
```

(edited)
*[*11:29*]* <https://clojurians.slack.com/archives/hoplon/p1454257789000441>
 
so the order definitely matters
<https://clojurians.slack.com/team/laforge49>
laforge49 <https://clojurians.slack.com/team/laforge49> *[*11:30 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257807000442> So where 
do I file the issue? :simple_smile:
<https://clojurians.slack.com/team/levitanong>
levitanong <https://clojurians.slack.com/team/levitanong> *[*11:30 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257821000444> yay I’m 
not crazy!
1 

*[*11:30*]* <https://clojurians.slack.com/archives/hoplon/p1454257826000445>
 
thanks, @micha <https://clojurians.slack.com/team/micha>, @laforge49 
<https://clojurians.slack.com/team/laforge49>  and @flyboarder 
<https://clojurians.slack.com/team/flyboarder>(edited)
<https://clojurians.slack.com/team/micha>
micha <https://clojurians.slack.com/team/micha> *[*11:30 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257832000446> :+1:
*[*11:30*]* <https://clojurians.slack.com/archives/hoplon/p1454257845000448>
 
i thought i fixed the lein template, no?
<https://clojurians.slack.com/team/laforge49>
laforge49 <https://clojurians.slack.com/team/laforge49> *[*11:31 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257863000449> doesn't 
look like it.
<https://clojurians.slack.com/team/micha>
micha <https://clojurians.slack.com/team/micha> *[*11:31 AM*]* 
<https://clojurians.slack.com/archives/hoplon/p1454257871000450> i think i 
didn't have permission to push it to clojars
*[*11:31*]* <https://clojurians.slack.com/archives/hoplon/p1454257881000451>
 
but the git repo should be fixed

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to