compojure.middleware

Optional middleware to enhance routing in Compojure.

remove-trailing-slash

(remove-trailing-slash uri)

Remove the trailing ‘/’ from a URI string, if it exists.

wrap-canonical-redirect

(wrap-canonical-redirect handler)(wrap-canonical-redirect handler make-canonical)

Middleware that permanently redirects any non-canonical route to its canonical equivalent, based on a make-canonical function that changes a URI string into its canonical form. If not supplied, the make-canonical function will default to remove-trailing-slash.