URL Properties for 3.node

Source: Internet
Author: User

Node's URL property

1.parse: [Function:urlparse],
2.format: [Function:urlformat],
3.resolve: [Function:urlresolve],
4.resolveObject: [Function:urlresolveobject],
5.URL: [Function:url],
6.URLSearchParams: [Function:urlsearchparams],
7.domainToASCII: [Function:domaintoascii],
8.domainToUnicode: [Function:domaintounicode]

A. cmd command line Input "node" To enter node execution environment

1.parse: [Function:urlparse]

Resolves the URL address, the second parameter is true, and the query resolves to become the object pattern url.parse ("http://www.imooc.com/video/6710", True) URL {    protocol: ' http: ',    slashes:true,    auth:null,    host: ' www.imooc.com ',    port:null,    hostname: ' www.imooc.com ',    Hash:null,    search: ',    query: {},    pathname: '/video/6710 ',    path: '/video/6710 ',    href: ' http:/ /www.imooc.com/video/6710 '} The second argument is true, the resolved query is the object pattern query: {form: "Scott", "Course": "Node"}

2.format: [Function:urlformat]

Restore URL address Url.format ({    protocol: ' http: ',    slashes:true,    auth:null,    host: ' Www.imooc.com ',    Port:null,    hostname: ' www.imooc.com ',    hash:null,    search:null,    query:null,    pathname: '/ video/6710 ',    path: '/video/6710 ',    href: ' http://www.imooc.com/video/6710 '})

3.resolve: [Function:urlresolve]

Stitching into legal attribute url.resolve ("http://www.imooc.com/", "/video/6710"); ' http://www.imooc.com/video/6710 '

 

URL Properties for 3.node

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.