2013-04-05 93 views
1

看着SockJS multiplex exampleSockJS复用示例404 index.html找不到

我得到了服务器运行。当我去http://127.0.0.1:9999/multiplex我看到一个可喜的消息“Welcome to SockJS!

当我尝试浏览器index.hmtl http://127.0.0.1:9999/index.html我得到404消息“Cannot GET /index.html

的“index.html”是在相同的目录server.js在跑。为什么服务器找不到这个文件?

回答

0

安装了快车3.1.1并做了一些code updates to server.js。现在,当我去http://127.0.0.1:9999/它提供了我的index.html在服务器指定:

app.get('/', function (req, res) { 
    res.sendfile(__dirname + '/index.html'); 
}); 

不知道为什么,但仍http://127.0.0.1:9999/index.html不给我的文件。

1

请仔细检查您是否使用了好的快递版本。 Express 3改变了API和代码可能需要一些调整。有关示例,请参阅sockjs-node/examples。

+0

ran'npm list'我的express版本是2.5.8,如package.json文件中指定的那样。我升级到表达3.1.1,进行了代码更改并仍然遇到相同的行为。这里是我的服务器的代码 - https://gist.github.com/dev-e-loper/5332522 – 2013-04-07 21:08:09