The QueryString module provides some useful functions for parsing and Formatting URL query strings: Using the following methods:
Const QueryString = require (' querystring ')//import node built-in module
Querystring.escape (str)
STR <string>
URL encoding for a given STR
This method is provided to QueryString () and is usually not used directly. The reason why it is open is to rewrite the implementation of the encoding when needed by assigning a function to the querystring.escape.
Querystring.parse (Str,[,sep[,eq[,option]])
All optional parameters are used to split the Str.
Such as:
Console.log (Qs.parse (' name:zhangsan,age:10 ', ', ', ': '))
The second parameter, meaning to, not split by, divides the string into intervals, dividing the result into two sets of data (the default is &)
Divide the word and string into {name: ' Zhangsan ', age:10} according to the comma
Third parameter: Meaning to Split field names and field values in each set of data
With name: ' Zhangsan ' as column, Name field name Zhangsan field value
Querystring.stringify usage is the opposite of odd.
Nodejs QueryString Query string