我有一个示例节点 js 文件,我在命令提示符下执行了它,但是它没有出现在浏览器中,
var http = require('http');
port = process.argv[2] || 8888;
http.createServer(function(request,response){
response.writeHead(200, { 'Content-Type': 'text/html' });
var PI = Math.PI;
exports.area = function (r) {
var res1 = PI * r * r;
response.end(res1, 'utf-8');
// alert(res1);
return res1;
};
exports.circumference = function (r) {
var res2 = 2 * PI * r;
response.end(res2, 'utf-8');
//alert(res2);
return res2;
};
}).listen(parseInt(port, 10));
console.log("file server running at\n => hostname " + port + "/\nCTRL + C to shutdown");
强文本 任何人都可以,请告诉我我在哪里做错了