javascript - Error Route Not Found on RestAdapter -
i have route configuration on router.js
import ember 'ember'; import config './config/environment'; var router = ember.router.extend({ location: config.locationtype }); router.map(function() { this.route('about'); this.resource('posts'); }); export default router;
and inside routes folder have posts.js
import ember 'ember'; export default ember.route.extend({ model: function() { return this.store.find('post'); } });
and inside model folder have ember-data model
import ds 'ember-data'; export default ds.model.extend({ title: ds.attr() });
and here's adapter
import ds 'ember-data'; export default ds.restadapter.reopen({ namespace: 'api' });
however whenever access resource(localhost:4200/posts) receive error
error while processing route: posts not found ember$data$lib$adapters$rest$adapter$$default<.ajaxerror@http://localhost:4200/assets/vendor.js:60763:35 ember$data$lib$adapters$rest$adapter$$default<.ajax/</hash.error@http://localhost:4200/assets/vendor.js:60838:37 jquery.callbacks/fire@http://localhost:4200/assets/vendor.js:3350:10 jquery.callbacks/self.firewith@http://localhost:4200/assets/vendor.js:3462:7 done@http://localhost:4200/assets/vendor.js:9518:1 .send/callback@http://localhost:4200/assets/vendor.js:9920:8
note:
i've set mock http rest server using command ember g http-mock post
found solution myself. turns out the mock needed create mock same name resource that's configured in router.js
so created new http mock using one
ember g http-mock posts
in case, turns out route specified should same json retrieving.
Comments
Post a Comment