This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-30
Channels
- # admin-announcements (1)
- # aws (32)
- # bangalore-clj (1)
- # beginners (2)
- # boot (137)
- # cider (2)
- # clara (1)
- # cljs-dev (39)
- # cljsrn (20)
- # clojure (268)
- # clojure-berlin (20)
- # clojure-canada (37)
- # clojure-dev (8)
- # clojure-gamedev (6)
- # clojure-norway (2)
- # clojure-russia (55)
- # clojure-spec (130)
- # clojure-uk (39)
- # clojurebridge (1)
- # clojurescript (102)
- # cursive (20)
- # datomic (231)
- # editors (5)
- # editors-rus (8)
- # events (5)
- # funcool (12)
- # hoplon (31)
- # instaparse (57)
- # jobs (9)
- # lein-figwheel (4)
- # off-topic (2)
- # om (8)
- # om-next (30)
- # onyx (241)
- # planck (6)
- # protorepl (4)
- # re-frame (115)
- # reagent (7)
- # rum (9)
- # schema (1)
- # test-check (9)
- # untangled (24)
- # yada (20)
What’s the state of using JWT for authentication? Seen sections in docs but not sure the functionality is there but no docs yet, or if it’s on the todo list.
Where is the yada.yada/path-for
described in https://juxt.pro/yada/manual/index.html#_resource_models ? I only see uri-for
in the namespace...
(And I don't want to use uri-for
, because I would need to use vhost)
hey I am curious about :parameters :form
I know a form can have multiple inputs but I am wondering about a single input that can be multiple e.g. :parameters {:form {:users [String]}}
a long those lines?
nevermind, turns out that does just work
@frozenlock My answer probably wasn't clear enough. vhost conveniently provides a uri-for, and puts it into the ctx.
Anything which puts a :uri-for
key into the ctx, that function will be called for you.
@kardan: there are some jwt examples under dev/src in the yada repo. It's all working and used in prod
@frozenlock: you have to use bidi's vhosts model to use yada/uri-for. Otherwise use bidi's path-for directly
malcolmsparks : does path-for
support yada resource ID? (I think I tried it a few days ago without much success.)
I also understand that yada.path-for
was removed in favor of uri-for
.
@malcolmsparks perfect - then I’ll dig in. Thanks
@frozenlock It should do - are you wrapping your resources in yada/handler?
Ah no, that must be it. I was using yada
it shouldn't matter - you should be able to put in resources in your bidi structure, or wrap them in yada/handler -both cases should work
It does seem to work with a minimal example... 😕 --- edit: I was wrong, I can't get it to work.
What is the advantage of using vhosts
over simply looking the scheme and host in the ctx?
I had asked in the datomic channel but thought I’d ask here too hey guys I’ve this query
(defn mult-lookup-user [db phones]
(let [result (d/q '[:find ?e ?phone
:in $ [?phone ...]
:where [?e :user/phone ?phone]] db phones)]
(map second result)))
(mult-lookup-user (d/db connect) ["0862561423" "0877654321"])
where it will return only existing phones, and running it standalone works perfectly but my issues is using with a yada resource, the important section below
{:post {:parameters {:form {:users [String]}
:body [String]}
:consumes #{"application/json" "application/x-www-form-urlencoded;q=0.9"}
:produces #{"application/json" "application/edn"}
:response (fn [ctx]
(let [users (or (get-in ctx [:parameters :body])
(get-in ctx [:parameters :form :users]))]
(when-let [valid-users (mult-lookup-user (d/db connect) users)]
(println "valid" valid-users)
(if (seq? valid-users)
(json/generate-string valid-users)))))}}
using the same input as when called standalone returns an empty list, but if I include just one value (valid of course) it returns that singular result. Can any help explain this issue?not sure if it was an error or mistake on my behalf but discovered that doing {:form {:users [String]}}
causes an array of input to be transformed into array with a singular value of all the values joined. but the solution was to (str/split (first users) #",”)