How Routing Works

Learn how routing works in Ember and the steps performed when a route is changed.

Routing configurations

The router.js file contains the configurations of our routes. It acts as a site map for the Ember application. This file contains the definition of all our routes. We can get an overview of our application structure by looking at the router.js file. Let’s bring it up in our editor and discuss its details:

Press + to interact
// app/router.js
import EmberRouter from '@ember/routing/router';
import config from 'ecommerce-app/config/environment';
export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}
Router.map(function () {
});
  • Line 2: We import the EmberRouter class from @ember/routing/router ...