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

polentz
polentz
Full Stack JavaScript Techdegree Student 11,748 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
PRO
Brad Chandler
Pro Student 11,649 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.