1.0.4 • Published 4 months ago

halchemy v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

halchemy for Javascript

HAL for humans

npm.io

npm.io

Do you have an API that serves data following the HAL specification? The halchemy library makes it easy for your client to make the most of that API.

Getting Started

Install halchemy using the package manager of your chosen language:

npm install halchemy

In your code, create an Api object with the URL of your API.

import { Api } from 'halchemy'

const api = new Api('http://example.org/api')

const root = api.root.get()                          // get the root resource
const people = api.follow(root).to('people').get()  // follow the people rel to get the list of people

// Issue a refund of $5 to everyone
for (const person of people._items) {
    const account = async api.follow(person).to('account').get()
    async api.follow(account).to('deposit').post({amount:5.00})
    console.log(`${person.name} has a new balance of ${account.balance}`)
}

Read the docs to learn more!

1.0.4

4 months ago

1.0.3

5 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.9.3

1 year ago

0.3.12

1 year ago

0.3.11

1 year ago

0.3.10

1 year ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.1

2 years ago