作为对 node.js 环境和哲学的全新了解,我想回答几个问题。我已经下载了用于 Windows 安装程序的 node.js 以及节点包管理器。Windows Cmd 提示符当前正在用于运行 nodejs 应用程序。
cls 清除命令窗口或命令提示符中的错误。 node.js 是否有等价物? console.clear 不存在 ;( 还是以其他形式存在?
我通过下面的代码创建了一个服务器
var http = require("http");
http.createServer(function (request, response) {
response.writeHead(200, {
"Content-Type": "text/html"
});
response.write("Hello World");
console.log("welcome world")response.end();
}).listen(9000, "127.0.0.1");
我将代码更改为下面并刷新浏览器以发现内容类型没有更改,我如何才能看到更改?
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
console.log("welcome world")
response.end();
}).listen(9000,"127.0.0.1");
原文由 Deeptechtons 发布,翻译遵循 CC BY-SA 4.0 许可协议
这适用于linux。不确定窗户。
您可以使用以下方式“欺骗”用户: