我在node.js上真的很新。我试试这个,但它只是打开一个空白页面。我做错了什么?
var http = require('http'),
fs = require('fs');
fs.readFile('index.html', function (err, html) {
if (err) {
throw err;
}
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(process.env.PORT || 3000);
});