Codebase list comidi-clojure / 29e2b71
Update README to describe (wrap-routes ...) Scott Walker authored 8 years ago Scott Walker committed 8 years ago
1 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4545 does.
4646
4747 Other than those differences, the API should be very close to compojure's.
48
49 You can apply a Ring middlware to all the handlers at the leaves of a route using ```wrap-routes```, which has behaviour analagous to its counterpart in compojure. Multiple middlewares can be applied to the same routes, with those applied later wrapped around those applied earlier. This allows you to create multiple routes wrapped with different middleware yet still combine them into one overarching route that can be introspected.
50
51 ```clj
52 (let [my-routes ...
53 my-singly-wrapped-routes (wrap-routes my-routes inner-middleware)
54 my-doubly-wrapped-routes (wrap-routes my-singly-wrapped-routes outer-middleware)
55 my-other-routes ...
56 my-wrapped-other-routes (wrap-routes my-other-routes other-middleware)
57 my-combined-routes (routes my-doubly-wrapped-routes my-wrapped-other-routes)]
58 ```
4859
4960 ## What does Comidi do?
5061