samedi 25 juin 2016

Ember error on refresh or direct URL

I was unable to find any current answers for this question.

I am building my latest project in Ember and while I am able to access the different routes directly and with refreshes locally, as soon as I build for production and host the site, this no longer works. I believe the slug portions of my routers are correct so not sure what I need to update.

Note: I am using Ember CLI.

Router.js

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('reviews', function() {
    this.route('index', {path: '/'});
    this.route('review', {path: '/:review_id'});
  });
  this.route('movies');
  this.route('about');
  this.route("error", { path: "*path"});
});

Review Model

export default Ember.Route.extend({
    model(params) {
        const id = parseInt(params.review_id);
        const movies = this.get('movies');
        return movies.getMovieById(id);
    },
    movies: Ember.inject.service()
});

If I try to directly access or refresh /about, /reviews, /movies, or /reviews/:review_id I am given a 404. Even though the about route doesn't have a model to retrieve any data. It's simply loading a template. The only route I can refresh on is the very index page of the site.




Aucun commentaire:

Enregistrer un commentaire