Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bobholt/ampersand-jsonapi-collection
JSON-API-compatible AmpersandJS Collection
https://github.com/bobholt/ampersand-jsonapi-collection
Last synced: 24 days ago
JSON representation
JSON-API-compatible AmpersandJS Collection
- Host: GitHub
- URL: https://github.com/bobholt/ampersand-jsonapi-collection
- Owner: bobholt
- License: mit
- Created: 2015-10-02T16:05:06.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-05T19:00:49.000Z (about 9 years ago)
- Last Synced: 2024-10-03T19:10:48.660Z (about 1 month ago)
- Language: JavaScript
- Size: 504 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ampersand-jsonapi-collection
AmpersandJSONAPICollection is a [JSON-API](http://jsonapi.org/)-compatible
extension of the
[AmpersandJS REST Collection](https://github.com/AmpersandJS/ampersand-rest-collection).It achieves this JSON-API compatibility by overriding select methods within
ampersand-rest-collection and adding appropriate HTTP headers to requests.## Installing
```
npm install ampersand-jsonapi-collection
```## API Reference
Except as described below, AmpersandJSONAPICollection has the same interface as
[AmpersandRestCollection](https://github.com/AmpersandJS/ampersand-rest-collection)
and [AmpersandState](https://github.com/AmpersandJS/ampersand-state).To ensure this, AmpersandJSONAPICollection passes all tests for
AmpersandRestCollection (version 5.0.0).The following methods have been overridden:
### parse model.parse(data)
This has been augmented to parse JSON-API formatted data: specifically a
format in which model attributes are nested within the structure
`{ data: [ { attributes: {} } ] }`.### serialize model.serialize()
This has been augmented in order to serialize data into the correct format
expected by JSON-API.