description Compojure Overview
Compojure is a Clojure framework built upon Ring and HTTP-kit for creating web applications. It provides a functional approach to routing and request handling, prioritizing clear, efficient code. Developers utilizing Clojure for backend development or those seeking a lightweight solution for building web services will find Compojure particularly useful.
help Compojure FAQ
Is Compojure still the recommended routing library for Clojure web apps?
Compojure remains widely used, but the Clojure community has largely shifted toward Reitit for new projects. Reitit offers data-driven route definitions and better performance through route compilation, while Compojure uses a macro-based DSL that many still find readable and familiar.
How does Compojure relate to Ring in the Clojure web stack?
Compojure is built on top of Ring, which is Clojure's standard HTTP abstraction—Ring handles the request and response maps while Compojure provides routing syntax on top. A Compojure route matches requests by HTTP method and path, then returns a Ring response map that Ring's server adapter sends to the client.
Can I use Compojure with HTTP-kit instead of Jetty?
Yes, Compojure routes are compatible with any Ring-compatible server adapter, including HTTP-kit, which offers async request handling and better performance under high concurrency than Jetty. You pass your Compojure handler to HTTP-kit's `run-server` function instead of Ring's default Jetty adapter.
How does Compojure compare to Reitit for performance and features?
Reitit claims significantly better routing performance than Compojure through its compiled, linear-dispatch routing engine and data-driven route definitions. Reitit also offers better tooling for route introspection, OpenAPI/Swagger spec generation, and route-level middleware composition.
explore Explore More
Similar to Compojure
See all arrow_forwardReviews & Comments
Write a Review
Be the first to review
Share your thoughts with the community and help others make better decisions.