用nodejs搭建了服務(wù)器,命令窗口顯示搭建成功了,但是瀏覽器無法訪問,請問是怎么回事?var http = require('http');var serv = http.createServer(function(req, res) {console.log('有人進(jìn)來了');
res.writeHeader(200, { 'content-type' : 'text/html;charset="utf-8"'
});
res.writeHeader(404, { 'content-type' : 'text/html;charset="utf-8"'
});
res.write('你要訪問的頁面資源不存在!');
res.end();
console.log(req);}).listen(3000);
- 2 回答
- 0 關(guān)注
- 3001 瀏覽
添加回答
舉報
0/150
提交
取消