Last active
December 16, 2015 06:58
-
-
Save piscis/5394829 to your computer and use it in GitHub Desktop.
bind piler compat with express 3.x socket.io
This file contains hidden or 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
// Install: express 3.x, socket.io 0.9.x, piler-compat | |
var express = require('express'); | |
var app = express(); | |
var piler = require('piler-compat'); | |
var http = require('http'); | |
var socketio = require('socket.io'); | |
// Express | |
app.configure(function(){ | |
//... express config | |
}); | |
// HttpServer | |
var srv = http.createServer(app); | |
// Socket.IO | |
var io = socketio.listen(srv); | |
io.configure(function(){ | |
// socket.io config | |
}); | |
// Piler setup | |
var js = piler.createJSManager(); | |
var css = piler.createCSSManager(); | |
// Bind piler to socket.io and express | |
js.bind(app,srv); | |
css.bind(app,srv); | |
// Binding http server | |
srv.listen('3000','0.0.0.0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment