例子中res指定了響應(yīng)頭,響應(yīng)體內(nèi)容為node.js,用end結(jié)束。 最后調(diào)用listen函數(shù),監(jiān)聽3000端口。 復(fù)制代碼代碼如下: var http = require('http'); http.createServer(function(req, res){ res.writeHead(200, {'Content-type' : 'text/html'}); res.write('Node.js'); res.end('Hello...
www.dbjr.com.cn/article/584...htm 2025-5-15