arachne

Project Page: http://arachne-framework.org/ Kickstarter: https://www.kickstarter.com/projects/1346708779/arachne-rapid-web-development-for-clojure
luke 2017-01-21T02:33:36.000053Z

Have at it!

7👍32👏3🎊12🦜3🎉
jfntn 2017-01-21T03:47:48.000054Z

Congrats!

defndaines 2017-01-21T18:19:18.000058Z

This is maybe more of a #leiningen question, but I stumbled on it when working through the “Creating a project” tutorial.... Is there something you need to do so that

(def w (->Widget))
works out of the box after starting with lein repl?

defndaines 2017-01-21T18:20:04.000059Z

Maybe I goofed some set-up, because I thought I’ve had this kind of thing work before (i.e., lein loading you into the project namespace, vs. needing to explicitly load things).

luke 2017-01-21T18:20:44.000061Z

You need to lead the namespace first, and then make sure that that namespace is “current” in your repl.

luke 2017-01-21T18:21:27.000062Z

So, if you just started with lein repl, you could do (require '[myproj.core]) and then (in-ns myproj.core)

luke 2017-01-21T18:21:53.000063Z

Or use the fully qualified name, (def w (myproj.core/->Widget))

defndaines 2017-01-21T18:25:10.000064Z

Thanks. I ended up doing the require approach, since for some reason the qualified namespace didn’t work. (That’s why I was wondering if I haven’t goofed my lein config somehow, unrelated to arachne.)

luke 2017-01-21T18:26:48.000065Z

Well you have to require it just to cause that NS to load... the functions in it aren't available until something such as a require has caused it to be loaded

defndaines 2017-01-21T18:38:40.000066Z

I see the difference now. If I lein repl for my other projects, by default I’m going into proj.core and have immediate qualified access to proj.core/ ns functions. But with the arachne config, I’m going into arachne.run, and my proj.core isn’t immediately available. Different from my usual workflow, since the require is implicit.

defndaines 2017-01-21T19:05:58.000067Z

BtW, I’m assembling typo fixes as I work through the tutorial. Is fork and pull request the best way to submit those?

luke 2017-01-21T19:07:54.000068Z

Yes, thank you! I know there's probably a lot of them :)

anmonteiro 2017-01-21T19:17:59.000069Z

@luke (really) off-topic, but I'd love it if you could expand on your workflow for writing and building the docs website

anmonteiro 2017-01-21T19:18:35.000070Z

I need to get around to building a docs website for Lumo and I liked Arachne's layout & organization

luke 2017-01-21T19:22:52.000071Z

@anmonteiro It’s pretty straightforward. I write the docs in markdown, then use a tool called “mkdocs” to build them into a static html site. I use the “codox” Clojure lib to generate API documentation (also static HTML). I have a script (which you can see at https://github.com/arachne-framework/arachne-docs/blob/master/deploy.sh), to merge the results of the two builds together and deploy them using Github Pages.

luke 2017-01-21T19:23:20.000073Z

took me like a day to get set up, would recommend :thumbsup:

anmonteiro 2017-01-21T19:23:29.000074Z

awesome, I'll explore. thanks!

2017-01-21T20:12:19.000075Z

An observation on the http tutorial: The way the greet handler is written makes me believe that localhost:8000/greet/ will return "Who's there?", but it seems that with a path of "/greet/:name" there needs to be something in :name, or it won't match.

luke 2017-01-21T20:13:02.000076Z

@madstap ah, great point. I forgot to put an example URL in there to make that clear. I’ll fix that in my next update. Thanks!

2017-01-21T21:50:02.000077Z

@luke I don't think I explained it very well...

(defn greeter
  [req]
  (let [name (get-in req [:path-params :name])]
    {:status 200
     :body (if (empty? name)

             "Who's there!?" ; This branch is never taken.

             (str "Hello, " name "!"))}))

(h/endpoint :get "/greet/:name" (h/handler 'myproj.core/greeter))

;; Because "/greet/:name" matches urls like site/greet/aleks,
;; but doesn't match site/greet or site/greet/
;; So :name can never be an empty string, nor nil