本人学生,正在钻研js。由于听人说前段开发也需要习惯在本地环境中开发web页面就选择了node作为本地环境。
已搭建一个简单node服务。
这是代码
var http = require("http");
//var path = require("path");
http.createServer(function(requrest,response){
response.writeHead(200,{"Content-Type": "text/plain"});
//var index = path.extname('./index.html');
var index = ''+
''+
'
'+''+
'
你好nodejs'+''+
'
'+'node.js'+
''+
'';
response.write(index);
response.end();
}).listen(8888);
在我从浏览器访问时直接返回了字符串如图
我还写了一个html文件但是不知道如何让node返回这个index.html给浏览器希望有朋有可以指点以下