Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Last active March 5, 2018 21:19
Show Gist options
  • Save samselikoff/2dce2cb48d113581278a22602b97be48 to your computer and use it in GitHub Desktop.
Save samselikoff/2dce2cb48d113581278a22602b97be48 to your computer and use it in GitHub Desktop.
Ember Data Storefront boilerplate
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
export default function() {
this.resource('posts');
}
export default function(server) {
let post = server.create('post');
server.createList('comment', 4, { post });
}
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
post: belongsTo()
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
comments: hasMany()
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.loadAll('post');
}
});
<h1>Ember Data Storefront boilerplate</h1>
{{#each model as |post|}}
<p>Post #{{post.id}}</p>
{{/each}}
{
"version": "0.13.0",
"ENV": {
"ember-cli-mirage": {
"enabled": true
}
},
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3",
"ember-data-storefront": "0.13.0",
"ember-cli-mirage": "0.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment