I have a Clojure-based chat bot that I start up in typical leiningen fashion with lein run. I'd like to add a front end to this app, but not totally sure how to go about it. From reading docs on compojure, lib-noir and ring, looks like the standard way to serve is with lein ring server. I'd rather just start up the app and the front end with a single lein command if possible. Would this involve manually starting up the server (in another thread perhaps) with something like (run-jetty handler {:port 3000}), or could anyone recommend a better approach?
Add webapp frontend to existing clojure app
238 Views Asked by devth At
1
There are 1 best solutions below
Related Questions in CLOJURE
- SSE implementation in Pedestal using individual channel per user
- Within a Clojure project using deps.edn, where is the package name and version tracked?
- How can I update and iterate the sub maps and update map into different location of map at the same time in clojure
- Out of memory in clojure - Nested reduce on Lazy Sequence
- Mac OS X - Brew installed Leiningen permission error / wrong directory
- Consume SpiceDB LookupResources gRPC stream from Clojure using Java gRPC library
- Server sent events in pedestal returns empty response
- How to make quarkus find my Clojure classes?
- Looking for a Clojure/LISP equivalent to Scons
- lazily calling functions for infinite sequence clojure
- Issue with Kafka in Clojure Repl for Arm64 M1
- Unable write parser where the AST can be turned into Clojure code
- Naming convention for simbol of clojure.core/atom, like !foo in Clojure
- How to nest a sequence of layered steps?
- How to type hint a float?
Related Questions in LEININGEN
- Mac OS X - Brew installed Leiningen permission error / wrong directory
- Looking for a Clojure/LISP equivalent to Scons
- Loading environment variables temporarily on nrepl start up
- lein deps fails with cljfx
- Function Namespace Conflicts in Clojure Project with Incanter
- Error loading a shared library when trying to run a Clojure project in NixOS
- How to set process name for Leiningen script so htop shows it as "lein" and not "java... "?
- What is wrong with my namespace declaration in this clojure project?
- OS Error 13 when running lein test in leiningen project clojure
- Leiningen unable to start a REPL: "Unable to resolve symbol: create in this context"
- Clojure in server plugin dev: calling classes that must be initialized after server startup
- Leiningen how to include dependency into result jar file
- how to define constants at compile time in clojure
- Calva Error "LSP classpath lookup failed when running `lein with-profile +test,+dev classpath`. "
- Releasing to AWS throws exception
Related Questions in RING
- Draw a ring using the HTML5 canvas without the straight line
- How can I disable the selection / focus halo in a swiftui list when displayed on an iPad / macOS so I can customize
- Reagent + Ring full stack Clojure + ClojureScript app receiving 403 `Invalid anti-forgery token`
- rust build error:failed to run custom build command for `ring v0.16.20`
- What is the difference between defn- and defn ^:private in Clojure?
- What is wrong with my namespace declaration in this clojure project?
- What wrong with run-jetty in the Clojure webapps with Ring?
- How to access the body of a request as a key map in clojure ring server
- RIng with Coercion url parameter returning :status 500
- clojure ring-http is not giving expected response
- lein ring server giving Compiler exception
- Monger session store
- Add content-type header to file-response
- Ring response unable to return JSON body on session POST
- Clojure map returned by JDBC becomes null after inspection
Related Questions in NOIR
- How to use IR leds that is not working on Pi camera
- Why is username not saved in noir session in Clojure project?
- How to save a user in noir session in a compojure web project?
- Can't extract multipart-params from POST request in compojure
- Is there an open source project that uses Hoplon and that handles web authentification?
- Repeatedly get random element in clojure
- Converting compojure noir to Liberator
- How do I make a page visible with or without ending slash in the url?
- Can you set the size limit of a post request in header?
- Build Noir validations rules with map
- how to get this working in webnoir
- How to test session state with Ring?
- In Clojure, is there an idiomatic way of destructuring a map in a macro definition?
- Noir css can't load?
- Generate img tags with Noir from a list
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
What do you understand under 'frontend' in your case? I see two possibilities.
First one is when your Clojure bot is completely standalone and has some external interface to interact with. In this case your frontend will be separate application talking with the bot via this external interface, and indeed in this case if you want to start your programs with single lein command you should be using explicit
-mainfunction in your webapp which will first run your bot and then start the server. I don't know exact command to start the server though; yours looks fine for me, but I think I read somewhere that this kind of startup was deprecated...Another possibility is when you want the webapp to be integrated into the bot. In this case you just write the webapp in such way that it uses namespaces of the bot directly; no
-mainfunction is required, and all you have to do is run thelein ring servercommand.The second one looks clearer to me, but it depends on overall architecture of your bot.
Update.
I have looked more thoroughly at how ring and leiningen work together, and it seems that the simplest way for you to get what you want is as follows. First, install
lein-ringplugin as its readme directs.Next, configure your
project.cljsimilarly to the following:See, you should have additional options in your
project.cljfile (they are described in the readme I have linked to above).:handleris your main web application handler (refer to ring documentation on what it is and why it is needed).:initshould be your initialization function. This is exactly the place you should add the code to to start your bot.Finally, issue
lein ring servercommand to start your webapp. This will first call a function you specified as:initin yourproject.clj, which in turn will start your bot, and then your webapp will be launched.