Thursday, March 31, 2011

Announcing status-codes

Announcing status-codes

status-codes is easy response status codes

It's easy status codes for compojure.
Not that status codes in compojure are particularly hard.
I just prefer in applications that I work with to use keywords for
status codes, rather than status codes as numbers.

(routes
(GET "/ok" _ :ok)
(GET "/accepted" _ :accepted)
(GET "/ok-map" _ {:status :ok})
(GET "/accepted-map" _ {:status :accepted}))

Not much really, but it reads better than 200, 202 and so on.
In order to have this sugar in your routes pick status-codes from
clojars, and require/use status-codes:

(ns your.ns
(:use status-codes))

Enjoy.

No comments:

Post a Comment