Ketting library is meant to be a generic HATEOAS library for Javascript using a simple, modern API. Currently it only supports the HAL and HTML formats, it supports an opinionated set of modern features REST services might have.

For example :

const ketting = new Ketting('https://api.example.org/');

// Follow a link with rel="author". This could be a HTML5 `<link>`, a
// HAL `_links` or a HTTP `Link:`.
const author = await ketting.follow('author');

// Grab the current state
const authorState = await author.get();

// Change the firstName property of the object. Note that this assumes JSON.
authorState.firstName = 'Evert';

// Save the new state
await author.put(authorState);

Ketting is a library that sits on top of a Fetch API to provide a RESTful interface and make it easier to follow REST best practices more strictly. Using this library it becomes very easy to follow links from a single bookmark, and discover resources and features on the server.

Written by Ever Pot and released under an MIT license.

For more information : https://github.com/evert/ketting

LEAVE A REPLY

Please enter your comment!
Please enter your name here