HAL hypermedia
HAL (Hypertext Application Language, IETF draft-kelly-json-hal-08). Wraps resources with _links + _embedded so clients discover navigation + nested resources without out-of-band routing. The spec is small; the framework's helper is correspondingly small.
Content-Type: application/hal+json
Reserved properties: - _links — { rel: linkObject | linkObject[] } per RFC 8288 - _embedded — { rel: resource | resource[] } - _templates — HAL-FORMS extension (operator-supplied)
b.hal.resource(payload, opts?) #
{
links: { [rel]: string | LinkObject | LinkObject[] },
embedded: { [rel]: object | object[] },
templates: { [name]: HalFormTemplate }, // HAL-FORMS extension
}
Build a HAL resource. payload is the operator's domain object; opts.links is a map of { rel: href | linkObject | linkObject[] }; opts.embedded is a map of { rel: resource | resource[] }.
var r = b.hal.resource(
{ title: "Hello", body: "World" },
{ links: { self: "/articles/1",
next: { href: "/articles/2", title: "Next article" } } }
);
Last updated 2026-08-08T16:39:49.652Z by seeder.