SockJS复用示例404 index.html找不到
看看SockJS复用的例子
我得到了服务器运行。 当我去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
正在运行在同一个目录下。 为什么服务器找不到这个文件?
请仔细检查您是否使用了好的快递版本。 Express 3改变了API和代码可能需要一些调整。 有关示例,请参阅sockjs-node / examples。
安装了express 3.1.1,并对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
仍然不给我的文件。