Fork me on GitHub

Are there any popular libraries for forms and/or synchronization?


I suspect many people must be rolling their own input validation and remote synchronization code.


I suppose it could be tough to write something configurable enough to satisfy the use cases of a wide audience.


Re-com, re-forms are two I know of


Hello, I had a "logged" middleware that was checking for a value in cookie so that was working fine but I now need to make an http call so now I'm dealing with async code and I have no idea how to keep this functionality as middleware


I'm coming back to a projet that was using reframe 0.3.0 so I may have missed some new features but the wiki didnt seem to change, at least for the talking to server and middleware sections


The async code will itself dispatch the result, right?


So there will be middleware on the disptched-to handler


(defn logged
  (fn logged-handler
    [db v]
    (if (is-logged?)
      (handler db v)


so the answer was no I guess


but now islogged would be async


Im a bit confused


Should I create an logged handler in opposition of a middleware that will take a follow-up action as param and decide to dispatch it or not


(dispatch [:logged :submit-form])


but I feel thats better as a middleware


wonder if anyone using reframe as frontend, clojure as backend, and managed to use figwheel to do the frontend stuff?


I am a bit confused. when using figwheel, js is served at 3449 port, normally backend will be at 8080 port. how does frontend fire ajax to backend? in prod, you could use relative url, but in dev, they are using different ports.


@rui.yang: I had the exact same problem a few weeks ago! Are you already using http-kit or jetty or any webserver for the backend, or were you like me and tried to go as long as possible using figwheel itself to run the backend 😛 ?


So my setup (I've been meaning to write this up but haven't yet, so this might be a bit rough): in project.clj defproject, I have :main app.handler, and in src/clj/app/handler.clj I have set up my Compojure app as well as http-kit startup.


So lein run will start the backend and start serving


I also have a Compojure route: (route/resources "/") so that http://localhost:3600/index.html (in your case, 8080 will be the port) will load index.html and pull down whatever cljs assets have been built by lein fighweel dev.


When you open that URL, the browser will try to connect to the figwheel websocket (http://localhost:3449) once a second, and will console.error if it can't reach it. If you run lein figwheel dev, that starts up figwheel's server, and your client connects to it and figwheel is running.


So I have two terminals, one running lein run and another running lein fighweel dev. (The third is a lein repl connected to the nrepl server running inside my app 😄)


This whole aspect of Clojure/Script was really confusing for me to figure out, and I'm sure the above was unclear so let me know where I can clarify. I would like to make a stand-alone repo showing how I at least do this… after my deadline next week


Chestnut is a lein template that sets this up for you. It uses om, but you could pull that out.


@fasiha: great tips, I have copied all your comments in case slack lose history. will have a play later if chestnut not working.


@danielcompton: thanks for pointing me to chestnut. it is great that figwheel has :ring-handler option, but I am trying out any idea how to incorporate pedestal with figwheel?