Skip to content

Instantly share code, notes, and snippets.

@obohrer obohrer/gist:c7011444273c36235558 Secret
Last active Dec 13, 2015

Embed
What would you like to do?
The goal here is to have a definition of api endpoints which can be used to generate documentation (iodocs for example). The "wrappers" entry allows each group or separate endpoint to specify wrappers around the endpoint implementation which can be used for auth checks, stats, ...
(endpoints->handler
(group "users"
{:doc
{:description "A group for users routes"
:name "Users routes"}}
(GET "/:id"
{:doc
{:description "Get a user"
:name "get-user"
:params {:id
{:type "string"
:description "The user id"}}}}
{{:keys [id]} :params}
stub)
(PUT "/:id"
{:wrappers [authenticated]
:doc
{:description "Update a user"
:name "update-user"
:params {:id
{:type "string"
:description "The user id"}}}}
{{:keys [id]} :params}
stub))
(group "posts"
{:doc
{:description "A group for posts routes"
:name "Posts routes"}}
(GET "/:id"
{:doc
{:description "Get a post"
:name "get-post"
:params {:id
{:type "string"
:description "The post id"}}}}
{{:keys [id]} :params}
stub)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.