Skip to content

Instantly share code, notes, and snippets.

@obohrer
Last active December 13, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obohrer/c7011444273c36235558 to your computer and use it in GitHub Desktop.
Save obohrer/c7011444273c36235558 to your computer and use it in GitHub Desktop.
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