这是我的代码我能够看到这个文件内容但是在刷新时,不是我输入本地主机和端口。
// Include http module,
var http = require("http"),
// And url module, which is very helpful in parsing request parameters.
url = require("url");
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var emitter = new EventEmitter;
var fdata="";
http.createServer(function (request, response) {
if(request.url=="/")
{
response.writeHead(200, {'Content-Type': 'text/html'});
fs.readFile("xhtmlJs.xhtml","UTF-8" ,function (err, data){
fdata=data;
});
response.write(fdata+"<br/>"+request.url);
response.end();
}
}).listen(1234);