Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Routes and Templates Challenge: Customizing URLs

Sue Dough
Sue Dough
35,800 Points

Modify the puppies route so that the path is /cute-puppies. Which answer is best?

What is the best way to answer this? Both of these work. One has a slash after cute-puppies.

AnimalShelter = Ember.Application.create();

AnimalShelter.Router.map(function() {
  this.resource('puppies', {path: '/cute-puppies'});
});
AnimalShelter = Ember.Application.create();

AnimalShelter.Router.map(function() {
  this.resource('puppies', {path: '/cute-puppies/'});
});

I believe that by using the / at the end you are defining it to use a directory. So it will for sure use the cute-puppies directory.

Otherwise /cute-puppies without the ending slash could be calling a directory or a file named cute-puppies.

1 Answer

I'd say if they both work, then the shorter one is better. You'll save one byte from the file size!