Skip to content

Commit 6336e97

Browse files
authored
Merge pull request #540 from HarenBroog/patch-1
add ember-cached-shoe info to README.md
2 parents 3ef9956 + 638a9aa commit 6336e97

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,29 @@ export default Ember.Route.extend({
376376
});
377377
```
378378

379+
### Think out of the Shoebox
380+
381+
Shoebox gives you great capabilities, but using it in the real app is pretty rough. Have you ever thought that such kind of logic should be done behind the scenes? In a large codebase, defining `fastboot.isFastboot` conditionals can be a daunting task. Furthermore, it generates a lot of boilerplate code, which obscures the solution. Sooner or later coupling with `shoebox` will spread over all routes.
382+
383+
That's why [ember-cached-shoe](https://www.npmjs.com/ember-cached-shoe) was born.
384+
385+
After installing and applying it, your routes can look like this:
386+
387+
`app/routes/my-route.js`:
388+
389+
```javascript
390+
import Ember from 'ember'
391+
392+
export default Ember.Route.extend({
393+
model() {
394+
// first call in a server makes actual ajax request.
395+
// second call in a browser serves cached response
396+
return this.store.findAll('posts')
397+
}
398+
})
399+
```
400+
And they still take advantage of caching in the `shoebox`. No more redundant AJAX for already acquired data. Installation details are available in the addon [README](https://github.com/appchance/ember-cached-shoe#ember-cached-shoe).
401+
379402
## Build Hooks for FastBoot
380403

381404
### Disabling incompatible dependencies

0 commit comments

Comments
 (0)