koa - Node.js http.createServer throws TypeError: listener must be a function -


index.js:

var koa = require('koa')   , primus = require('primus.io')   , http = require('http')   , app = koa()   , server = http.createserver(app);  var primus = new primus(server, { transformer: 'websockets', parser: 'json' });  primus.on('connection', function (spark) {   spark.send('news', { hello: 'world' });   spark.on('my other event', function (data) {     console.log(data);   }); });  app.get('/', function (req, res) {   res.sendfile(__dirname + '/index.html'); });  server.listen(8080); console.log('8080'); 

run: node --harmony index

and err: throw typeerror('listener must function');

you need change code this:

server = http.createserver(app.callback())


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -