Created
November 6, 2017 17:28
-
-
Save marialomidze/8910e0bf13b1e6072b470f25e6a159c6 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Mirage from 'ember-cli-mirage'; | |
| export default function() { | |
| window.server = this; | |
| this.get('authors/'); | |
| this.get('authors/:id'); | |
| this.get('books/'); | |
| this.get('books/:id'); | |
| // this.delete('authors/:id'); | |
| this.delete('books/:id'); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Factory, association } from 'ember-cli-mirage'; | |
| export default Factory.extend({ | |
| title: faker.company.companyName, | |
| // author: association() | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function(server) { | |
| /* let author = server.create('author', { | |
| name: 'John Steinbeck' | |
| }); | |
| server.create('author-details', { | |
| author, | |
| hometown: 'Salinas' | |
| }); | |
| */ | |
| // let books = server.createList('book', 3) | |
| server.createList('author', 3); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Switching from JSONAPISerializer to REST results in error `normalizeResponse must return a valid JSON API document` even when creating a REST Adapter | |
| /* | |
| import { JSONAPISerializer } from 'ember-cli-mirage'; | |
| export default JSONAPISerializer.extend({ | |
| }); | |
| */ | |
| import { RestSerializer } from 'ember-cli-mirage'; | |
| export default RestSerializer.extend({ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import DS from 'ember-data'; | |
| export default DS.Model.extend({ | |
| title: DS.attr('string'), | |
| author: DS.belongsTo('author') | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Route.extend({ | |
| model() { | |
| return this.store.findRecord('author', 1 /*, { | |
| include: 'author-detail' | |
| }*/); | |
| /* | |
| return { | |
| // "authors": [ | |
| // { | |
| "name": "Johnny Steinbeck", | |
| "authorDetailId": "1", | |
| "id": "1", | |
| "authorDetail": | |
| { | |
| "hometown": "Salinas", | |
| "authorId": "1", | |
| "id": "1" | |
| } | |
| // } | |
| // ] | |
| } | |
| */ | |
| }, | |
| afterModel(model){ | |
| debugger | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import DS from 'ember-data'; | |
| //export default DS.JSONAPISerializer.extend({ | |
| //}); | |
| export default DS.RESTSerializer.extend({ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.10.7", | |
| "ENV": { | |
| "ember-cli-mirage": { | |
| "enabled": true | |
| } | |
| }, | |
| "EmberENV": { | |
| "FEATURES": { | |
| "ds-finder-include": true | |
| } | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "2.10.0", | |
| "ember-data": "2.10.0", | |
| "ember-template-compiler": "2.10.0", | |
| "ember-testing": "2.10.0" | |
| }, | |
| "addons": { | |
| "ember-cli-mirage": "0.3.2" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment