سؤال

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