Giter Site home page Giter Site logo

torstenk / ketting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from badgateway/ketting

0.0 0.0 0.0 3.39 MB

The HATEOAS client for javascript

Home Page: https://www.npmjs.com/package/ketting

License: MIT License

JavaScript 0.30% TypeScript 99.41% Makefile 0.29%

ketting's Introduction

Logo Ketting - The HATEOAS client for javascript

Check out the Wiki for full documentation.

Introduction

The Ketting library is a generic REST client with Hypermedia features.

The library will work with any JSON-based HTTP API, but it gets superpowers when using it with formats that have support for links, including:

And it even works with HTML links, and HTTP Link Headers.

Ketting is designed to both work in the browser and in Node.js. Additionally, it has react bindings that will make it work in a way that's familiar to Apollo-Client users.

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.data.firstName = 'Evert';

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

Docs

Notable Features

Ketting is a library that sits on top of Fetch API to provide a RESTful interface and make it easier to follow REST best practices more strictly.

It provides some useful abstractions that make it easier to work with true hypermedia / HATEOAS servers. It currently parses many hypermedia formats and has a deep understanding of links and embedded resources. There's also support for parsing and following links from HTML documents, and it understands the HTTP Link: header.

It also has support for 'fetch middlewares', which is used to implement OAuth2 support, but also opens the door to development of other plugins.

Using this library it becomes very easy to follow links from a single bookmark, and discover resources and features on the server.

Read further on the Wiki

ketting's People

Contributors

evert avatar hugothomas avatar mhum avatar greenkeeper[bot] avatar dayre avatar dependabot[bot] avatar reda-alaoui avatar juhangsin avatar madsmadsen avatar wiese avatar simistern avatar qmachard avatar ravinggenius avatar mihok avatar kay-is avatar jameswomack avatar sazzer avatar germanp avatar gabesullice avatar bolt04 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.