Created
April 19, 2012 20:48
-
-
Save dbainbridge/2424055 to your computer and use it in GitHub Desktop.
How to use socket.io with Express 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http'); | |
var app = express(); | |
var server = app.listen(3000); | |
var io = require('socket.io').listen(server); | |
app.configure(function(){ | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
app.use(express.favicon()); | |
app.use(express.logger('dev')); | |
app.use(express.static(__dirname + '/public')); | |
app.use(express.bodyParser()); | |
app.use(express.methodOverride()); | |
app.use(app.router); | |
}); | |
app.configure('development', function(){ | |
app.use(express.errorHandler()); | |
}); | |
app.get('/', routes.index); | |
console.log("Express server listening on port 3000"); |
Thank you, it was helpful. It's number one result for "using express 3 and socket.io".
Thanks !!!!
thanks!
the 7th line"http = require('http');", ti's neccesary? i did't see you use http
Thanks, it works.
Perfect, thank you!
Thanks!
Thanks!
Thanks a lot !
Thank you !
Thank you !
You Rock! Thank you
Thank you!
Excelent, Thank You :)
Thanks a ton!
👍
Good one... Thanks alot!!!
Niceeee!! Thank you!! ;)
Works like a charm. Stackoverflow posts failed to help me, but this works like a charm.
Very helpful, thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked like a charm. Thanks!