Reputation: 462
i've read the answers here about my problem in node.js, but my problem persists. With socket.io in the server, everything looks ok, but in client side, chrome says: Failed to load resource: the server responded with a status of 404 (Not Found) localhost:3382/socket.io/socket.io.js
var express = require("express");
var http = require("http");
var _io = require("socket.io");
var PORT = 3382;
var app = express();
app.listen(PORT, function(){
console.log("Listening from "+PORT);
});
var server = http.createServer(app);
var io = _io.listen(server);
With jade i have:
script(src='/js/jquery.js')
script(src='/js/chat.js')
script(src="socket.io/socket.io.js")
I have the folder js in a folder static, it works ok. I don't know if it's because the versions (node -v show v0.8.16), how do i see versions of express and socket.io?
Upvotes: 3
Views: 3341
Reputation: 2228
Read through http://expressjs.com/api.html#app.listen, note how app.listen
is defined.
In short: replace app.listen
with server.listen
.
Upvotes: 5