Fork me on GitHub
#clojuredesign-podcast
<
2019-07-18
>
genekim20:07:32

Hello, @neumann @nate — I’m loving your fabulous podcast. Your episode on fakes inspired me, and I finally got around to trying to build one for a ClojureScript app that talks to the Trello API (via a Clojure web server). I managed to build a couple of commands for a ServerTrello and FakeTrello interface, and now I’m wondering how you typically tell the app whether you want it to hit the real server, or the fake server? I ended up setting a global JS variable called fake, which I read in my CLJS app, and then use it to set a var to either the fake or real, umm.. what do you even call it... Interface? Protocol? Do you have any advice on how to do this better? Many thanks in advance!!! And keep up the great work! PS: I now realize I should be using a case instead of a cond, and will likely make more interfaces so I can pull them out of that ugly switch expression — I had forgotten that I wrapped some of my Trello server calls in a go block... https://gist.github.com/realgenekim/4375188bba08300612b1e00b62f6555e#file-trello_interfaces-cljs-L131

genekim20:07:33

(Oof. Cringing at that awful def inside of a defn, but it worked... :)

nate20:07:31

Hey @genekim, welcome to the channel!

nate20:07:02

I'm not at a computer right now, but I will be later. I'll check out the code and respond then.