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 Express Basics Parameters, Query Strings, and Modularizing Routes Randomize Cards

polentz
seal-mask
.a{fill-rule:evenodd;}techdegree
polentz
Full Stack JavaScript Techdegree Student 11,755 Points

Why in the pug template he did not have to include the /cards part of the url?

Why could he omit the initial part of the URL (in the pug template) and it does still work? Just curious about it to better understand how all this works.

Thanks in advance

1 Answer

Brad Chandler
Brad Chandler
15,301 Points

I believe it is because anchor tags use relative URLs.
Since the anchor exists in the /cards route, the app knows to look in that route for the requested URL.