Simplifies REST API consumption by modeling endpoints as classes with caching, relationship resolution, validation, and attribute normalization. Current version 0.11.0. Release cadence is irregular with last update in 2021. Differentiators include automatic caching with configurable TTL, cross-resource attribute resolution (e.g., await comment.resolveAttribute('post.author.city')), and built-in validation/normalization hooks.
npm install rest-resourceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows defining a Resource subclass, fetching detail/list, modifying attributes, and saving.
Use static getter or static property: static endpoint = '/users'
Define cacheMaxAge static property in your Resource subclass.
Always use Resource.detail(id) or Resource.list() to fetch instances.
Add static endpoint = '/your-path' to the class.
Use import Resource from 'rest-resource'
Use await Resource.detail(id) instead of new Resource().
No dependency data recorded yet.