Node.js:URL, QueryString Introduction

Source: Internet
Author: User

URL URLs parsing

URL: Uniform Resource Locator, letter, number, text to be encoded
URI: Uniform Resource Identifier, string format specification

Note: URLs are a subset of URIs

    1. Url.parse (urlstring, Bool,bool)

      Parameter 1:url parse to object, Parameter 2: Convert Qurey to JSON object, Parameter 3: correctly parse URL without protocol (HTTP)

    2. Url.format (Urlobj);

    3. Url.resolve (From,to) merges two strings into a full URL address

      Parameter 1: Hyperlink; parameter 2: Road

Parameter interpretation

Protocol: Protocol
Slashes: Does the "//" containing the agreement
Host:ip address or domain name or hostname
Port: Ports (default 8080 not shown)
Hostname: Host Name
Hash: Anchor Point value
Search: Query string parameters
Query: Data for HTTP, ibid.
Pathname: Access to the resource path name
Path: Resource path to access
HREF: Full URL address

QueryString
      1. Querystring.stringify (OBJ,SIGN1,SIGN2)
        Convert the object to the form of the query part of the URL

        Parameter 1: object to convert, Parameter 2: Link (default &), Parameter 3: symbol between key and value (default =)

      2. Querystring.parse (STRING,SIGN1,SIGN2,SIGN3)
        Convert query string to object (deserialize)

        Parameter 1:query string, Parameter 2: Linker (default &), Parameter 3: symbol between key and value (default =), Parameter 4: Number of parameters (default up to 1000, 0 means no limit)

      3. Querystring.escape (String) text compilation

      4. Querystring.unescape (String) decompile

Node.js:URL, QueryString Introduction

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.