node.js 模块之url和querystring模块

关系如下:

                       url.parse(string).query
                                           |
           url.parse(string).pathname      |
                       |                   |
                       |                   |
                     ------ -------------------
http://localhost:8888/start?foo=bar&hello=world
                                ---       -----
                                 |          |
                                 |          |
              querystring(string)["foo"]    |
                                            |
                         querystring(string)["hello"]


pathname不包括query string,

http://localhost:8888/start
的pathname为/start.注意有斜线。
访问http://localhost:8888
的pathname为/.

原文地址:https://www.cnblogs.com/youxin/p/3954740.html