Hello I’m new in ember.js
I try to use http-mock, so I typed belows.
ember g http-mock destinations
I already have destination model, adapter, route.
My server/mocks/destinations.js
destinationsRouter.get('/', function(req, res) {
res.send({
"destinations": [{
id: 1,
title: "Destination 1"
}, {
id: 2,
title: "Destination 2"
}
]});
});
and, my app/routes/destinations.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
// return this.store.find('destination');
return [{
id: 1,
title: "Destination 1"
}, {
id: 2,
title: "Destination 2"
}, {
id: 3,
title: "Destination 3"
}, {
id: 4,
title: "Destination 4"
},
];
}
});
I tested remove comment return this.store.find(‘destination’);
console print out
GET http://localhost:4200/destinations 404 (Not Found)
I think my app didn’t have address /destinations because
Router.map(function() {
this.route('destinations', { path: '/' },function(){
this.route('new', { path: '/new' });
this.route('edit', { path: '/edit/:destination.id' });
this.route('destination', { path: '/:destination.id'});
});
});
I cant find example of http-mock.
how to assemble this situation? I want to use http-mock.