@hateoas-ts/resource - A type-safe HATEOAS client for HAL-compliant REST APIs.
This library provides:
import { createClient, Entity, Collection } from '@hateoas-ts/resource';// Define entity typestype User = Entity< { id: string; name: string }, { self: User; posts: Collection<Post> }>;// Create client and navigateconst client = createClient({ baseURL: 'https://api.example.com' });const user = await client.go<User>('/users/123').get();// Follow HATEOAS linksconst posts = await user.follow('posts').get(); Copy
import { createClient, Entity, Collection } from '@hateoas-ts/resource';// Define entity typestype User = Entity< { id: string; name: string }, { self: User; posts: Collection<Post> }>;// Create client and navigateconst client = createClient({ baseURL: 'https://api.example.com' });const user = await client.go<User>('/users/123').get();// Follow HATEOAS linksconst posts = await user.follow('posts').get();
@hateoas-ts/resource - A type-safe HATEOAS client for HAL-compliant REST APIs.
This library provides:
Example: Basic usage