0

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.

5
  • 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. Commented Dec 30, 2017 at 20:37
  • Ok, but, that being said, in my search, I should have at least been able to find one answer. Commented Dec 30, 2017 at 20:40
  • Copy your existing namespaces and dependencies into a template. There you are, an answer. Commented Dec 30, 2017 at 20:41
  • 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). Commented Dec 31, 2017 at 1:36
  • I can highly recommend reading the Web development with Clojure book, see pragprog.com/book/dswdcloj2/… Commented Mar 14, 2018 at 8:15

1 Answer 1

0

Any of the following would have been acceptable answers: Selmer, Hiccup, Enlive.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.