const
http = require('http'),
koa = require('koa'),
app = koa(),
serve = require('koa-static'),
server = http.createServer(app.callback()),
io = require('socket.io')(server);
app.use(serve('./public'));
io.on('connection', function (socket) {
socket.on('click', function (data) {
//process the data here
console.log('client clicked! data:');
console.log(data);
// emit an event
console.log('responding with news');
socket.emit('news', { hello: 'world' });
});
});
var port = process.env.PORT || 3000;
server.listen(port);
console.log ('Listening at port ' + port + ' ...');
ошибка TypeError: Class constructor Application cannot be invoked without 'new'
Точнее как это обойти, почему понятно.