This project has been deprecated.
FastBoot-Data-Route is a library for handling the serialization and use of the Fastboot Shoebox data. This library serializes each route model into a seperate shoebox to maintain route state. It then decides whether or not to return shoebox data instead of running your normal model method.
This fixes any loading route issues you might have using fastboot, and also allows you to use ember data's store.query and still return the correct data when the web app boots up and re-renders.
This addon requires use of ember data.
For more information about FastBoot, see www.ember-fastboot.com, the Ember CLI addon that's a prerequisite for developing FastBoot apps.
Installing the library is as easy as:
ember install ember-fastboot-data-route
import Ember from 'ember';
export default Route.extend({
modelName: 'user',
beforeModel() {
this._super(...arguments);
...othercode
},
model() {
const query = {
enabled: true
firstName: 'Tom'
};
return this.store.query('user', query);
},
afterModel() {
this._super(...arguments);
...othercode
}
});
There are 3 things you need to keep in mind.
- A modelName property is required, as that is needed to serialize the data to the correct model type.
- Any beforeModel defined by your app must call the super method
- Any afterModel defined by your app must call the super method