[ANN] Compojure 1.2.0

165 views
Skip to first unread message

James Reeves

unread,
Oct 1, 2014, 9:54:14 PM10/1/14
to clo...@googlegroups.com, Compojure
Compojure 1.2.0 has been released, marking the first new minor version in quite some time. There aren't many major changes, but the code base has been polished and modernised, and some new functions and macros added.

The minimum Clojure version has been upped to 1.5.1, and the source has had a significant clean-up. In particular, the old custom lexer in Clout has been replaced with Instaparse. This paves the way for future additions to the routing syntax that weren't possible under the old system.

Improvements have been made to how Compojure handles files and resources, and it is now better at providing sensible defaults. For example, if you return a resource, URL or file from a route, Compojure will now attempt to fill in the content-type, content-length and last-modified headers.

Aside from a good amount of polish, Compojure 1.2 also includes several new functions, aimed at improving interoperability. The compile-route function is now public, allowing libraries to write their own route macros. There is also a new rfn macro, allowing Compojure's binding and response rendering to be used with different routing libraries.

Another fairly significant addition is the wrap-routes middleware function, which applies middleware only after a route has been matched. Up until now there was no easy way to achieve this without wrapping each route individually. This is particularly useful for certain types of middleware, such as those that deal with authorisation.

- James
Reply all
Reply to author
Forward
0 new messages