문제

Looking at SockJS multiplex example

I got the server running. When I go to http://127.0.0.1:9999/multiplex I see a welcome message "Welcome to SockJS!"

When I try to browser to index.hmtl http://127.0.0.1:9999/index.html I get 404 message "Cannot GET /index.html"

The 'index.html' is in the same directory as the server.js is running. Why can't the server find this file?

도움이 되었습니까?

해결책 2

Installed express 3.1.1 and made some code updates to server.js. Now when I go to http://127.0.0.1:9999/ it serves me index.html as specified in server:

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

Not sure why but http://127.0.0.1:9999/index.html still doesn't give me the file.

다른 팁

Please double check if you're using good express version. Express 3 changed API's and code may require some tweaking. See sockjs-node/examples for examples.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top