我正在尝试使用 nodejs 启动 index.html 页面,但由于某种原因,在将其推送到 Heroku 后,我不断收到应用程序错误。知道我的代码有什么问题吗?
#/!/usr/bin/env node
var express = require('express');
var app = express.createServer(express.logger());
app.get('/', function(request, response) {
var fs = require('fs');
var buffer = new Buffer();
response.send(buffer.toString('utc-8', fs.readFileSync("index.html")));
});
var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
});