node.js 模块之url和querystring模块

时间:2022-01-02 11:58:30

关系如下:

                       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为/.