0
votes

I have a terminal app built in Clojure and connected to MySQL, but I would like to know the simplest way to add a front-end to it. I came across this post (that is 5 years old) that recommends ring, and set it up: Add webapp frontend to existing clojure app.

After adding deps to project, added handler function to core.clj:

(defn handler [request]
  {:status 200
   :headers {"Content-Type" "text/html"}
   :body "Hello World"})

Started a webserver and got output "Hello World."

Ok, now what? I am familiar with templates like Figwheel that allow you to build Clojurescript right out of the box (that doesn't come with a back-end?) and tools like Reagent that allow you to write React with Clojurescript, but what I am interested in is, how to add a front-end to an already existing terminal app, in whatever framework I choose, be it plain React, Clojurescript with Reagent, Angular, or even old-fashioned HTML/CSS/Javascript. It seems there are lots of templates but no instructions for how to do it from scratch.

1
No reason you can't use a template as a starting place to figure out what modifications you need to your existing application. That said, the real problem with this question is its scope -- there are, as you say, a plethora of tools; and adopting each and every one of them is going to be different. As such, this question is far too wide to allow a canonical answer. - Charles Duffy
Ok, but, that being said, in my search, I should have at least been able to find one answer. - Jessie Richardson
Copy your existing namespaces and dependencies into a template. There you are, an answer. - Charles Duffy
I had a perhaps relevant concern (project template with both client and server) and got a strong recommendation on this: github.com/danielsz/holygrail. Perhaps you can drop your existing backend code into a new project made from that template (or get brave and extend your existing project incrementally based on what you see in the template). - kennytilton
I can highly recommend reading the Web development with Clojure book, see pragprog.com/book/dswdcloj2/… - Odinodin

1 Answers

0
votes

Instead of a down-vote, any of the following would have been acceptable answers: Selmer, Hiccup, Enlive.