A hypermedia client/library supporting several media formats. HAL, Siren, and Link header extensions are included by default, but support for other media types can be added. For the most part, the core library is not normally used directly, instead consumed by way of a small framework integration layer, e.g. angular-hy-res.
For any questions, please post to the HyRes Google Group.
For release announcements and updates, you can also follow @petejohanson:
hy-res is available via NPM. To install:
$ npm install --save hy-res
Note: The API is still evolving, so during the 0.0.x series of releases there are no API stability guarantees Those users needed a stable API should set an explicit version in package.json
hy-res is inspired by AngularJS'
$resource service that focuses on using hypermedia
controls, links (and/or embedded resources) discovered by link relation, to traverse a hypermedia enabled API.
hy-res itself is not dependant on AngularJS, and can be used standalone along w/ the axios
library. For deep AngularJS integration, leveraging the
$http service, use the angular-hy-res
For details, see refer to the API documentation.
A complete working example can be found at angular-hy-res-example, which demonstrates the below pagination concept. A public copy is deployed to Heroku at:
For example, given a HAL collection resource that uses the standard link relations
prev to control
paging through the collection, and the
item relation for each item in the collection, here is a sample response:
Then the controller can easily be:
And the view:
- Submit form file uploads? Maybe allow consumers to provide populated FormData
- Handle scenario where subset of links for a given link relation is embedded. For this scenario, we should really return a mix of resolved embedded resources and unresolved resources that result from following the non-embedded links.
- Extensions for other media types (e.g. Uber, Mason)
- Support URI schemes other than http/https (extension mechanism?)
- Mixins for resources based on... profile? link relation that was followed?
- Differentiate between embedded link vs embedded representation (See Siren spec)
- Handling or error types, e.g. application/problem+json
- Support for PUT of modified resource to replace server state?