Assume that this is a url http://localhost:8080/a/b/c?a=1&
protocol: ‘HTTP:’,// protocol
host: ‘localhost:8080’,
port: ‘8080’,// port
hostname: ‘localhost’, domain
hash: ‘#abcd’,
search: ‘?a=1& B = 2 ‘,
query: ‘a = 1 & amp; B =2 ‘,
pathname: ‘/a/b/c’,
path: ‘/a/b/c?a=1& B = 2 ‘,
href: ‘http://localhost:8080/a/b/c?a=1& B = 2 # ABC ‘
Url.parse () can break a complete URL into many parts, such as host, port, Pathname, path, and Query
var http = require("http");
var url = require("url");
var server = http.createServer(function(req,res){
var pathname = url.parse(req.url).pathname;
var query = url.parse(req.url).query;
console.log("patname:"+ pathname);
console.log(query);
res.end();
});
server.listen(80,"127.0.0.1");
Read More:
- Error: No such keg: /usr/local/Cellar/node&install nvm&brew installation&Oh my zsh.git installation&git set alias&No bundle URL prese
- Error: no such keg: / usr / local / cellular / node & install NVM & Brew install & oh my Zsh. Git install & git set alias & no bundle URL press
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- Browser prompt: Source mapping error: request failed with status 404 Source URL: http://xxx.js Source mapping URL: jquery.min.map
- Uncaught TypeError: Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’.
- Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node How to Fix
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- VUEJS Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of
- [Solved] gitbook: node_modules\npm\node_modules\graceful-fs\polyfills.js:287
- The Ethereum private chain is built, and the block information cannot be synchronized. The error is resolved: Node data write error err=”state node failed with all peers(1 tries, 1 peers)
- Node start – create a server listening port.
- After node.js is installed, use the instruction node version in vscode to show that it is not an external or internal instruction. The solution is as follows:
- Zuul gateway routing URL and service ID configuration
- JSON parse error: invalid UTF-8 solution series
- VxWorks parse error near int
- Jetson nano uses Python to read and parse GPS data (GPRMC, gpgga).
- Solving failure executing javac, but could not parse the error
- Conda HTTP 000 CONNECTION FAILED for url
- Video download problem of blob type URL
- When websocket transmits JSON text, the parse method reports an error