Skip to content

/nowjs/now.js doesn't work in Express 3 #200

Closed
goldfire opened this Issue May 3, 2012 · 3 comments

4 participants

@goldfire
goldfire commented May 3, 2012

When running Express 2.5.9 and below I can load the client script from /nowjs/now.js just fine, but when I switch to Express 3.0.0alpha2, I get:

Cannot GET /nowjs/now.js
@710THz
710THz commented Jun 9, 2012

In Express 3 'express' is a function not a server. So you have to pass it the server.

var server = http.createServer(app).listen(app.get('port'), function() {
    console.log('Express server listening on port ' + app.get('port'));
}

var everyone = require('now').initialize(server);
@goldfire goldfire closed this Jul 3, 2012
@centerax

excellent, thanks gscmedia, this fixed my problem too, also removed the notice I was getting "Socket.IO's listen() method expects an http.Server instance
as its first parameter. Are you migrating from Express 2.x to 3.x?
If so, check out the "Socket.IO compatibility" section at:
https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x"

@individual11

For anyone in the future who runs across this thread, make sure you do the

var server = http.createServer(app);

before you do any of your app settings (e.g. app.use, app.set). It gave me serious trouble for hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.