var http = require (' http '); Http.createserver (function (req, res) {Console.log (Req.url); Console.log (Req.method); Console.log ('-------------------------------------------'); Res.writehead ($, {' Content-type ': ' Text/plain '}); Res.end (' Hello world\n ');}). Listen (1337, "127.0.0.1"); Console.log (' Server running at http://127.0.0.1:1337/');
The server-side output when accessing is as follows:
/ssss?ssget-------------------------------------------/ Favicon.icoget-------------------------------------------/ssssqget-------------------------------------------/ Favicon.icoget-------------------------------------------/ssssq/ Index.htmlget-------------------------------------------/ Favicon.icoget-------------------------------------------
Originally every time you visit the Web browser will make two requests, a normal request, an icon request, you should do special processing of the icon request
Nodejs receive GET Request (Favicon.ico)