JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Randomize Cards

Full Stack JavaScript Techdegree Student 11,749 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
Courses Plus Student 14,080 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.