forked from emberjs/data
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: README files for Debug, Adapter and Serializer (emberjs#8533)
* chore: update licence year * feat: ReadMe for the Adapter Package * feat: readme for the serializer package * fix: ensure readme and license assets are published * nicer description * add readme for debug package * better description
- Loading branch information
Showing
31 changed files
with
295 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,97 @@ | ||
@ember-data/adapter | ||
============================================================================== | ||
<p align="center"> | ||
<img | ||
class="project-logo" | ||
src="./ember-data-logo-dark.svg#gh-dark-mode-only" | ||
alt="EmberData Adapter" | ||
width="240px" | ||
title="EmberData Adapter" | ||
/> | ||
<img | ||
class="project-logo" | ||
src="./ember-data-logo-light.svg#gh-light-mode-only" | ||
alt="EmberData Adapter" | ||
width="240px" | ||
title="EmberData Adapter" | ||
/> | ||
</p> | ||
|
||
[Short description of the addon.] | ||
<p align="center">Provides REST and JSON:API Implementations of the legacy <a href="https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Adapter">Adapter Interface</a></p> | ||
|
||
> **Caution** ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used. | ||
> If starting a new app or thinking of implementing a new adapter, consider writing a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Handler) | ||
> instead to be used with the [RequestManager](https://github.com/emberjs/data/tree/main/packages/request#readme) | ||
Compatibility | ||
------------------------------------------------------------------------------ | ||
## Installation | ||
|
||
* Ember.js v3.4 or above | ||
* Ember CLI v2.13 or above | ||
This package is currently installed when installing `ember-data`. | ||
|
||
If installing `@ember-data/` packages individually install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/) | ||
|
||
Installation | ||
------------------------------------------------------------------------------ | ||
```no-highlight | ||
pnpm add @ember-data/adapter | ||
``` | ||
|
||
## 🚀 Setup | ||
|
||
If using `ember-data` no additional setup is necesssary. | ||
|
||
> **Note** When using [ember-data](https://github.com/emberjs/data/blob/main/packages/-ember-data) the below | ||
> configuration is handled for you automatically. | ||
To use legacy adapters you will need to have installed and configured the LegacyNetworkHandler from [@ember-data/legacy-compat](https://github.com/emberjs/data/blob/main/packages/-ember-data) | ||
|
||
```no-highlight | ||
pnpm add @ember-data/legacy-compat | ||
``` | ||
|
||
```ts | ||
import Store, { CacheHandler } from '@ember-data/store'; | ||
import RequestManager from '@ember-data/request'; | ||
import { LegacyNetworkHandler } from '@ember-data/legacy-compat'; | ||
|
||
export default class extends Store { | ||
requestManager = new RequestManager(); | ||
|
||
constructor(args) { | ||
super(args); | ||
this.requestManager.use([LegacyNetworkHandler]); | ||
this.requestManager.useCache(CacheHandler); | ||
} | ||
} | ||
``` | ||
ember install @ember-data/adapter | ||
|
||
|
||
## Usage | ||
|
||
To use as either a per-type or application adapter, export one of the | ||
implementations within the `adapters/` directory of your app as appropriate. | ||
|
||
For instance, to configure an application adapter to use `JSON:API` | ||
|
||
|
||
*app/adapters/application.ts* | ||
```ts | ||
export { default } from '@ember-data/adapter/json-api'; | ||
``` | ||
|
||
By default adapters are resolved by looking for an adapter with the same name in the adapters folder as the `type` given to `store.adapterFor(<type>)`, falling back to looking for an adapter named `application`. | ||
|
||
**Overriding Resolution** | ||
|
||
Usage | ||
------------------------------------------------------------------------------ | ||
If you would like to avoid using resolver semantics and your application has only one or a few adapters, you may ovveride the `adapterFor` hook on the store. | ||
|
||
[Longer description of how to use the addon in apps.] | ||
```ts | ||
import Store from '@ember-data/store'; | ||
import Adapter from '@ember-data/adapter/json-api'; | ||
|
||
class extends Store { | ||
#adapter = new Adapter(); | ||
|
||
adapterFor() { | ||
return this.#adapter; | ||
} | ||
} | ||
``` | ||
|
||
License | ||
------------------------------------------------------------------------------ | ||
|
||
This project is licensed under the [MIT License](LICENSE.md). | ||
For the full list of APIs available read the code documentation for [@ember-data/adapter](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fadapter). You may also be interested in learning more about *Ember***Data**'s [Adapter Interface](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Adapter). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.