DEV Community

Discussion on: How does Vue.js, Angular, or Ember do data store?

Collapse
 
nullvoxpopuli profile image
NullVoxPopuli • Edited

Ember has the library ember-data, which handles all relational data for you. It currently only works with REST-based apis ({json:api} being the best spec in REST for this), but it manages cache / requests / etc for you. No need to configure anything.

usage is this:

export default class MyComponent extends Component {
  @service store;

  async fetchUsers() {
    return await this.store.findAll('user');
  }
}
Enter fullscreen mode Exit fullscreen mode

and then later down the road when you want to read from the cache, you can this.store.peekAll('user') for synchronous access to the cache

More information here: guides.emberjs.com/release/models/