jmckitrick 2021-02-10T12:37:47.080100Z

Ah, ok. Let me take a look at that.

zach 2021-02-10T20:53:19.082100Z

Hi, I was wondering if any folk had experience with running the re-frame template as full-stack (e.g. using the +handler extra). I am trying to make an app where there’s the main route, which would be an SPA powered by reframe, and an /api route, that has some calls made directly to the server. I can’t quite seem to make it work, though, and am unsure if I’m understanding that +handler extra correctly.


I don’t think I’ve heard of the +handler extra, what is that?

zach 2021-02-10T20:58:25.083900Z

It adds compojure, so that the resulting app has both a clj/app and cljs/app namespace. With compojure, it setups the server and defines basic routing:

(defroutes routes
  (GET "/" [] (resource-response "index.html" {:root "public"}))
  (resources "/")
  (not-found "Page not found"))


Oh, it’s a luminus thing. Gotcha, that makes sense now.


or not luminus, re-frame itself I guess?

zach 2021-02-10T21:00:30.086400Z

And this is likely just me not getting a concept, but if i add the route (GET "/api" [] "api a go") it just returns a blank page. It looks like it’s still trying to have re-frame handle the routing for this path and not be server-side.


Ok, re-reading your original post, that should have been clear to me. (Long day 😛 )

zach 2021-02-10T21:01:01.087300Z

(haha, no worries!)


Ok, so how are you hitting that /api endpoint?


Are you making an ajax call from the browser or just going to it directly?


Actually, I should back up and review my compojure stuff, just a sec

zach 2021-02-10T21:02:26.089800Z

ah, good question! I am just visiting it in the browser.

dpsutton 2021-02-10T21:02:48.090500Z

evaluate (not-found "Page not found") returns. i think you need a bit more structure than you're giving there


We’ve switched to reitit and now my compojure-foo is rusty.


You might want to have a look at


If you haven’t done so already.


I.e. just start up a toy compojure project, without re-frame, and see how you get on with that.

dpsutton 2021-02-10T21:05:47.092500Z

((route/not-found "not here!") :dummy)
{:status 404,
 :headers {"Content-Type" "text/html; charset=utf-8"},
 :body "not here!"}


Compojure and re-frame fit together nicely, so once you’ve got the compojure side down I think you’ll have no problem putting the two together.

zach 2021-02-10T21:07:13.093600Z

Ah, that’s a good idea. Thanks all! Yeah, I’m finding some of my confusion especially new…and should maybe step back from the template (for example: should I be running two repls with this template now, one for server and one for client?)


I’m running two repls, server and browser. I started from a different template tho.

zach 2021-02-10T21:09:19.094600Z

Is there a template you recommend for studying?


I’d say start with the compojure one, get compojure working, then do the re-frame one, should get your feet off the ground.

zach 2021-02-10T21:12:16.095900Z

Sweet, thank you!


@webmaster601 instead of using re-frame-template, you might also want to use the templates used by luminus ... they are more backend focused. You can add +re-frame to their templates