ember.js - EmberJS Mirage 404 error on get /rentals -


i'm following tutorial on page (https://guides.emberjs.com/v2.7.0/tutorial/installing-addons/) until next tutorial page. (actually follow until finished tutorial.)

everything seems working fine. ✔
ember server serving , display in browser correctly. ✔
ember development build display correctly. ✔

but ember production build give me /rentals 404 error. ✖
how fix 404 error on production build?

here mirage/config.js

export default function() {    // these comments here started. feel free delete them.    /*     config (with defaults).      note: these affect routes defined *after* them!   */    // this.urlprefix = '';    // make `http://localhost:8080`, example, if api on different server   // this.namespace = '';    // make `api`, example, if api namespaced   // this.timing = 400;      // delay each request, automatically set 0 during testing    /*     shorthand cheatsheet:      this.get('/posts');     this.post('/posts');     this.get('/posts/:id');     this.put('/posts/:id'); // or this.patch     this.del('/posts/:id');      http://www.ember-cli-mirage.com/docs/v0.2.x/shorthands/   */    this.get('/rentals', function(db, request) {     let rentals = [{         type: 'rentals',         id: 1,         attributes: {           title: 'grand old mansion',           owner: 'veruca salt',           city: 'san francisco',           type: 'estate',           bedrooms: 15,           image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/crane_estate_(5).jpg'         }       }, {         type: 'rentals',         id: 2,         attributes: {           title: 'urban living',           owner: 'mike teavee',           city: 'seattle',           type: 'condo',           bedrooms: 1,           image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/alfonso_13_highrise_tegucigalpa.jpg'         }       }, {         type: 'rentals',         id: 3,         attributes: {           title: 'downtown charm',           owner: 'violet beauregarde',           city: 'portland',           type: 'apartment',           bedrooms: 3,           image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/wheeldon_apartment_building_-_portland_oregon.jpg'         }       }];      if(request.queryparams.city !== undefined) {       let filteredrentals = rentals.filter(function(i) {         return i.attributes.city.tolowercase().indexof(request.queryparams.city.tolowercase()) !== -1;       });       return { data: filteredrentals };     } else {       return { data: rentals };     }   });  } 

the url prefix , namespace don't change anything, still /rentals 404 error.

get http://localhost/rentals 404 not found
"networkerror: 404 not found - http://localhost/rentals"
error while processing route: index ember data request /rentals returned 404

ember-cli-mirage disabled in production build, should explicitly enable in config:

if (environment === 'production') {   env['ember-cli-mirage'] = {     enabled: true   }; } 

mirage documentation


Comments