https://github.com/cottrellio/aurelia-orbit-poc
Implements OrbitJS into an AureliaJS app for JSON-API support (proof of concept)
https://github.com/cottrellio/aurelia-orbit-poc
Last synced: 11 months ago
JSON representation
Implements OrbitJS into an AureliaJS app for JSON-API support (proof of concept)
- Host: GitHub
- URL: https://github.com/cottrellio/aurelia-orbit-poc
- Owner: cottrellio
- Created: 2017-08-02T04:22:12.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-03T07:37:17.000Z (almost 9 years ago)
- Last Synced: 2025-05-14T06:40:42.283Z (about 1 year ago)
- Language: JavaScript
- Size: 23.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aurelia-orbit-poc
This is a quick and dirty proof of concept for using [OrbitJS](orbitjs.com) in an [AureliaJS](aurelia.io) app as a data layer for requesting/ managing JSON API data.
## Get it running
1. Clone it
2. run `npm install` in the root
3. run `npm start` (it's built from the esnext webpack skeleton).
## OrbitJS Usage
### tl;dr
I'm using the store as the main source with an indexedDB source as the backup. It also uses a indexedDB bucket (so you can inspect the dev tools and see your datas). Finally, it uses JSONAPIsource as the remote source which handles all of the requests. There is a coordinator that hooks into requests/updates on the store and synce both the remote source as well as the backup.
I just followed the "Getting Started" section on [orbitjs.com](http://orbitjs.com/v0.15/guide/getting-started.html). Check it out for a more detailed explanation.
## Highlights
+ You should put the store in a service so you can use it throughout your app.
+ set Orbit.fetch to use the http-fetch-client.fetch
```javascript
import { HttpClient } from 'aurelia-fetch-client';
import Orbit from '@orbit/core';
...
const client = new HttpClient();
// Use http-fetch-client.
Orbit.fetch = client.fetch;
```
+ Remember to delete the `IndexedDB` databases as you make changes to the code.
## Special Thanks
+ Thanks to [Rob Eisenberg](https://github.com/EisenbergEffect) and friends for building AureliaJS!
+ Thanks to [Dan Gebhardt](https://github.com/dgeb) and friends for buidling OrbitJS!
Hope this helps someone :)