我是 javascript 新手,我想指定一个 javascript 程序从文件中读取并将文件的内容打印到控制台?这是我在下面编写的代码并且出现错误,请问它有什么问题?
var express = require('express');
var app = express.createServer(express.logger());
app.get('/',function(request,response){
var fs = require('fs');
var buffer = new Buffer(fs.readFileSync('index.html','utf8'));
response.send(Buffer.toString());
});
var port = process.env.PORT || 5000;
app.listen(port,function()
{
fs.readFileSync();
console.log("Listening on"+ port);
}
);