This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-24
Channels
- # admin-announcements (1)
- # aws (3)
- # beginners (52)
- # boot (150)
- # braid-chat (1)
- # braveandtrue (5)
- # bristol-clojurians (2)
- # cider (21)
- # cljs-dev (1)
- # cljsfiddle (1)
- # cljsjs (5)
- # cljsrn (4)
- # clojars (3)
- # clojure (236)
- # clojure-berlin (2)
- # clojure-czech (1)
- # clojure-madison (1)
- # clojure-russia (164)
- # clojure-sdn (1)
- # clojure-sg (2)
- # clojure-uk (64)
- # clojurescript (149)
- # core-async (31)
- # cursive (33)
- # datomic (2)
- # devcards (5)
- # funcool (3)
- # hoplon (142)
- # immutant (27)
- # juxt (7)
- # lein-figwheel (6)
- # liberator (6)
- # off-topic (4)
- # om (46)
- # onyx (26)
- # parinfer (5)
- # perun (56)
- # proton (6)
- # re-frame (19)
- # reagent (1)
- # remote-jobs (12)
- # ring-swagger (17)
- # slack-help (2)
- # spacemacs (11)
- # specter (1)
- # untangled (11)
- # yada (3)
@ikitommi: i got around to writing my custom meta-data handler, if you have time it'd be great if you could let me know if i'm going about it the right way - https://gist.github.com/mikos/071f542d1d9085cb6536 thanks 😃
@mikecarter: I would recommend moving the binding symbol to metadata, something like: :load-entry [entry (find-by-id ...)]
@juhoteperi: thanks! then pass the entry to :exists?
- is this the best way to return a 404 if an entry doesn't exist?
I wouldn't say there is one way that is better than others
With c-api I have just written the check inside handler body
But :exists? meta handler looks like what we have been doing with Kekkonen
cool, thanks man
it's just a feature i liked when i used Liberator
Maybe it would make sense to do both exist check and load in one handler (like currently)
yeah - that's how Liberator does it I believe
it loads it if it exists, and 404s if not
But I would recommend changing the magic _entry
symbol to one what is defined in metadata
And I'm not sure but possibly using anonymous function in macro like that might be non-optimal
I think the code in gist will recreate the anonymous function for each request
ah - i'll look into that, thanks
not sure how else to do it as find-by-id
obviously relies on the ID being passed in the request
perhaps it would be simpler to have the check in the body, as you said previously