Kill lui lei Dog---node. js---8url module and util module

Source: Internet
Author: User

Let's go to the manual to see:

It was clearly written to return an object.

Then look at the Util module,

Nonsense no oh more say, first a little bit of code:

/** * Created by Leigood on 2016/8/13.*/varHTTP = require (' http ');varurl = require (' URL '));varUtil = require (' util '));varServer = Http.createserver (function(req,res) {Res.writehead (200,{"Content-type": "Text/plain"});//Plain, let him format the output of the dataRes.write (Util.inspect (Url.parse (Req.url)));//This is the URL that is submitted by the client, and the purpose of Util.inspect is to allow the object to be read normally .res.end ();}); Server.listen (3002); Console.log (' URL OK ');

The test results are as follows:

Then customize some of the data to test it:

The effect was successful.

Kill lui lei Dog---node. js---8url module and util module

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.