I'm getting this error "NetworkError: 404 Not Found - http://localhost:3000/socket.io/socket.io.js"
and I don't know how can I fix it. I have tried changing the port, adding the link with the port ... and I have no idea.
My app.js :
var express = require('express')
, http = require('http')
, stylus = require('stylus')
, nib = require('nib')
var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);
function compile(str, path) {
return stylus(str)
.set('filename', path)
.use(nib());
}
app.set('views', __dirname + '/views')
app.set('view engine', 'jade')
app.use(express.logger('dev'))
app.use(stylus.middleware(
{ src: __dirname + '/public'
, compile: compile
}
))
app.use(express.static(__dirname + '/public'))
app.get('/', function (req, res) {
res.render('index',
{ title : 'Home' }
)
})
app.listen(3000)
note: The console said it's ok ( info - socket.io started )
Anyway I have tried this
app.listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
but doesn't print the port, say me undefined