import Ember from 'ember';
import config from './config/environment';
import googlePageview from './mixins/google-pageview';

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

Router.map(function() {
  this.route('logout');
  this.route('login');
  this.route('github_login');
  this.route('github_authorize', { path: '/authorize/github' });
  this.route('crates');
  this.route('crate', { path: '/crates/*crate_id' }, function() {
    this.route('download');
    this.route('versions');
    this.route('reverse_dependencies');

    // Well-known routes
    this.route('docs');
  });
  this.route('me', function() {
    this.route('crates');
    this.route('following');
  });
  this.route('install');
  this.route('search');
  this.route('dashboard');
  this.route('keywords');
  this.route('keyword', { path: '/keywords/*keyword_id' }, function() {
  });
  this.route('catchAll', { path: '*path' });
});

export default Router;

import Ember from 'ember';
import config from './config/environment';
import googlePageview from './mixins/google-pageview';

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

Router.map(function() {
  this.route('logout');
  this.route('login');
  this.route('github_login');
  this.route('github_authorize', { path: '/authorize/github' });
  this.route('crates');
  this.route('crate', { path: '/crates/*crate_id' }, function() {
    this.route('download');
    this.route('versions');
    this.route('reverse_dependencies');

    // Well-known routes
    this.route('docs');
  });
  this.route('me', function() {
    this.route('crates');
    this.route('following');
  });
  this.route('install');
  this.route('search');
  this.route('dashboard');
  this.route('keywords');
  this.route('keyword', { path: '/keywords/:keyword_id' }, function() {
      this.route('index', { path: '/' });
  });
  this.route('catchAll', { path: '*path' });
});

export default Router;

Use explicit "index" route for /keywords/:id
Ember: Use explicit "index" route for /keywords/:id

The "index" route would be generated automatically but only if the function() {}
exists. Having an empty function in the definition looks strange though so
should define the route explicitly here.
