Skip to content

aprobus/hyper-clj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyper-Clj

A Clojure library for representing hypermedia.

Lein

To use in Leiningen, add as a dependency:

[hyper-clj "0.1.1"]

Usage

Create a representer like this:

(ns books.core
  (:require [hyper-clj.core :refer :all]))

(defhyper represent-book [book author]
  :item book
  :link-self (str "/books" (:id book))
  :embedded-author author
  :meta-info "Meta info")

and then call it with:

(represent-book {:title "For Whom The Bell Tolls" :id 10} 
                {:name "Ernest Hemingway"})

which results in:

{:title "For Whom The Bell Tolls"
 :_links {:self {:href "/books/10"}}
 :_embedded {:author {:name "Ernest Hemingway"}}
 :_meta {:info "Meta info"}}

Any meta/link/embedded is supported. Simply prepend the config with the appropriate word.

License

Copyright © 2015 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published