Fork me on GitHub
#yada
<
2016-01-12
>
meow08:01:20

what's the main strength of yada

meow08:01:37

and can it be useful in an om.next app, or is that a stupid question

meow08:01:10

we're working on a chat app to replace slack and I'm just making sure we use the right tools

mccraigmccraig10:01:24

@meow: i'm using yada with a re-frame app, which also happens to be a chat app - it's strengths for me are [1] fully async [2] resources are data (i can walk and update a tree of resources) [3] swagger [4] parameter validation and coercion with prismatic schema [5] it does HTTP - e.g. a badly formatted request (fails schema checks) will return a 400 without any effort on your part

meow13:01:37

@mccraigmccraig: sounds great - can you help with #C0CB40N8K and #C0J20813K cc: @rafd:

mccraigmccraig13:01:08

@meow: my time is limited - i probably won't have any in the near to medium future for programming - but since i've been developing a chat app i might have had some useful experiences, which i'm happy to share

davesnowdon13:01:07

I’m failing at the first hurdle trying to get started with yada. I’ve created a new project with the following dependencies: [[org.clojure/clojure "1.7.0"] [aleph "0.4.1-beta3"] [yada "1.1.0-20151231.174657-5"]] The code is: (ns yadahello.core (:require [aleph.http :refer [start-server]] [yada.yada :refer [yada resource]])) (defn run [] (start-server (yada "Hellow world") {:port 3000})) When I import my package I get the following error: CompilerException java.io.FileNotFoundException: Could not locate clojure/core/cache__init.class or clojure/core/cache.clj on classpath., compiling:(clojure/core/memoize.clj:1:1) If I change to using yada 1.0.0 I don’t get the error, but then I run into issues trying to get some of the examples from the manual to work (PUTing to a resource backed by an atom just sets the atom to nil for example)

meow14:01:28

@mccraigmccraig: sharing is caring ❤️

meow14:01:38

thank you for sharing

malcolmsparks19:01:24

@davesnowdon: as per our email conf, add the following to your deps: ` [org.clojure/core.cache "0.6.4"]`

malcolmsparks19:01:41

repeating here so others can see I care simple_smile

malcolmsparks19:01:04

(and in case anyone else is at the same hurdle) - apologies, have fixed already on my next commit

malcolmsparks19:01:04

@meow: I'm happy to help #C0CB40N8K too. I believe yada is the currently the best HTTP library for Clojure, but I'm somewhat biased

meow19:01:58

@malcolmsparks: I look forward to working with you

davesnowdon19:01:48

@malcolmsparks: thanks Malcolm, I confirm it now works in my env

malcolmsparks19:01:29

I didn't know about braid. Nice name for a clojure chat program!

malcolmsparks20:01:47

@davesnowdon: you were asking in #C0522EZ9N about OAuth2 support. I was working on that over the weekend actually - in OAuth2 parlance you'd use yada for your resource server and the upcoming release has another multimethod for the type in Authentication header, e.g. Basic, Digest, Bearer (OAuth2) and can also authenticate based on cookies (Custom)

malcolmsparks20:01:57

You /could/ write an authentication server (login screens, totp, etc.) in yada, but that's not provided out of the box. The next release has some security examples for Basic, Login Form (cookie), and others

malcolmsparks20:01:11

I'm keen on supporting my new yubikey xmas toy too

malcolmsparks20:01:19

that's relatively straight forward

malcolmsparks20:01:34

you can also use a third-party auth server like http://keycloak.jboss.org/ which uses asymmetric keys

malcolmsparks20:01:08

it will sign a token with its private key, and you can use the public key to verify the Bearer token, which I believe is a JWT like @mccraigmccraig is using

malcolmsparks20:01:01

My examples use buddy's buddy-sign for JWT tokens, and I may provide that 'in the box' with yada because it's a good implementation which juxt have used on a number of projects

malcolmsparks20:01:02

but essentially the job of verifying the Bearer token is the up to you

malcolmsparks20:01:13

btw. the yada on master supports CORS headers fully, not HSTS yet but it's on the way