jeudi 10 novembre 2016

How to store and load models from Ember data to and from local files?

I'm giving it a go at making an Ember Electron app and wanting to save some model data to a json or json-api formatted file instead of pushing it to a remote API, what would be the best way to do this?

I see that it is possible to call .toJSON() on model objects to get a basic JSON representation of the model, from which I can save it to disk using electron-settings, however I'm at a loss on how to load the data in.

From what I can see, using the "push" function in Ember data allows you to import data, however it seems it expects JSON-API format instead:

https://guides.emberjs.com/v2.9.0/models/pushing-records-into-the-store/




Aucun commentaire:

Enregistrer un commentaire