Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ember Twiddle Demo: Mirage with Ember Twiddle

Ember Twiddle Demo: Mirage with Ember Twiddle

Demo

This is a very trivial example of using mirage with Ember Twiddle.

import Ember from 'ember';
export default Ember.Controller.extend({
});
import Collection from 'ember-cli-mirage/orm/collection';
export default function() {
window.server = this;
this.get('/foo', function (schema, request) {
var posts = [{
author: {name: 'Jane Eyre'}
}, {
author: {name: 'Emily Dickinson'}
}];
return posts;
});
};
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return $.get('/foo');
}
});
<header>
<h1>Mirage</h1>
</header>
<ul>
{{#each model as |post|}}
<li>{{post.author.name}}</li>
{{/each}}
</ul>
{
"version": "0.11.3",
"ENV": {
"ember-cli-mirage": {
"enabled": true
}
},
"EmberENV": {},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.11.0",
"ember-data": "2.11.0",
"ember-template-compiler": "2.11.0"
},
"addons": {
"ember-cli-mirage": "0.2.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.