我对所有这些技术都很陌生(包括一些JavaScript)所以你可能不得不忍受我.
我非常密切地关注了Socket.IO文档中的ChatApp教程,并将应用程序修改为我的喜好; 但是,我不认为我在服务器交互方面做了很多改变.我的问题是无论我做什么,我似乎无法让我的应用程序成功运行在Heroku上.我在尝试加载应用时收到此错误消息:
应用程序错误应用程序中发生错误,无法提供您的页面.请稍后重试.如果您是应用程序所有者,请检查日志以获取详细信息.
我不确定我是否遗漏了一些明显的或什么.
这是我的主要index.js文件:
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendfile('index.html');
});
app.use("/css", express.static(__dirname + '/css'));
//array of users currently in chat
var people = {};
io.on('connection', function(socket){
console.log('user connected!');
socket.on('join', function(name){
people[socket.id] = name; //create entry in 'people' with new user
socket.emit("update", "You have connected to the server.");
io.sockets.emit("update", name + " has joined the server.");
io.sockets.emit("update_people_list", people);
});
socket.on('disconnect', function(){
console.log('user disconnected!');
if(people[socket.id] …Run Code Online (Sandbox Code Playgroud)