The challenge was to create a simple web framework in Clojure using the Quarkus framework as a base. Quarkus is a full-stack, Kubernetes-native Java framework, and Clojure is a dynamic, general-purpose programming language. To start, a Quarkus app was created using the quarkus create command, and the project was configured to recognize clj files by adding a config in pom.xml. A Clojure file was then created to define routes and handlers, with a simple structure to declare routes. To enable Quarkus to handle the Clojure program, the Clojure dependency was added to pom.xml, and a Java file was created to load the Clojure core and setup the router. The Java file used the Clojure var function to load the quarkus-clj.core namespace and invoke the routes function, which returned a vector of route maps. Each route map was then used to create a handler and configure the route in Quarkus. Finally, the app was run using quarkus dev, and the declared route was opened to see the result. This example demonstrated how to use Clojure inside a Quarkus app to create dynamic routes. With just a few steps, the two ecosystems were connected, and a basic routing system was set up.
dev.to
dev.to