Node.js url.parse() and pathname property

后端 未结 5 1545
遇见更好的自我
遇见更好的自我 2020-12-14 06:33

I\'m reading a getting started book on node.js called The Node Beginner Book and in the code below (given in the book) I don\'t understand the significance

5条回答
  •  一向
    一向 (楼主)
    2020-12-14 06:59

    pathname is the path section of the URL, that comes after the host and before the query, including the initial slash if present.

    For example:

    url.parse('http://stackoverflow.com/questions/17184791').pathname    
    

    will give you:

    "/questions/17184791"
    

提交回复
热议问题