@ember-data-mirror/rest

5.4.0-alpha.49 • Public • Published

EmberData REST EmberData REST

Elegantly composable. Made for RESTful APIs

This package provides utilities for working with RESTful APIs with EmberData.

Installation

Install using your javascript package manager of choice. For instance with pnpm

pnpm add @ember-data-mirror/rest

Getting Started

If this package is how you are first learning about EmberData, we recommend starting with learning about the Store and Requests

Request Builders

Request builders are functions that produce Fetch Options. They take a few contextual inputs about the request you want to make, abstracting away the gnarlier details.

For instance, to fetch a resource from your API

import { findRecord } from '@ember-data-mirror/rest/request';

const options = findRecord('ember-developer', '1', { include: ['pets', 'friends'] });

/*
  => {
    url: 'https://api.example.com/v1/emberDevelopers/1?include=friends,pets',
    method: 'GET',
    headers: <Headers>, // 'Content-Type': 'application/json;charset=utf-8'
    op: 'findRecord';
    records: [{ type: 'ember-developer', id: '1' }]
  }
*/

Request builder output may be used with either requestManager.request or store.request.

URLs are stable. The same query will produce the same URL every time, even if the order of keys in the query or values in an array changes.

URLs follow the most common REST format (camelCase pluralized resource types).

Available Builders

Readme

Keywords

Package Sidebar

Install

npm i @ember-data-mirror/rest

Weekly Downloads

157

Version

5.4.0-alpha.49

License

MIT

Unpacked Size

64.7 kB

Total Files

17

Last publish

Collaborators

  • hm_krystan
  • richgt
  • ember-data-admin
  • runspired
  • hjdivad
  • rwjblue
  • stefanpenner
  • bmac
  • fivetanley
  • dgeb
  • igort
  • kellyselden
  • heroiceric