weavejester/compojure — pull request #118 by nbeloglazov (2014-10-08 21:35:04+00:00)
Title: Skip nil handlers while performing routing.

It would be nice to have ability to have optional routes. Use case: in dev environment you want to have some additional backdoor HTTP-route that should not be present in prod. Something like this:
```clojure
(defn login-routes [config]
(routes
(POST "/login" [] ...)
(POST "/logout" [] ...)
(when (= (:env config) :dev)
(POST "/force-login" [] ...)))
```
Currently it would break if we had some routes defined after "/force-login" route.

Workaround is not very hard:
```clojure
(defn login-routes [config]
(->> [(POST "/login" [] ...)
(POST "/logout" [] ...)
(when (= (:env config) :dev)
(POST "/force-login" [] ...)]
(remove nil?)
(apply routes))
```
But it doesn't look as nice and would be handy to have nil-handling in compojure itself.