28 lines
571 B
JavaScript
28 lines
571 B
JavaScript
// libraries
|
|
var
|
|
http = require('http'),
|
|
socketio = require('socket.io'),
|
|
express = require('express'),
|
|
gulp = global.gulp = require('gulp');
|
|
|
|
// gulp the sources
|
|
require('./gulpfile');
|
|
gulp.start('default');
|
|
|
|
// socket.io framework
|
|
let app = express();
|
|
let web = http.Server(app);
|
|
let io = socketio(web);
|
|
|
|
// Listen server
|
|
web.listen(8080, function () {
|
|
console.log('listening on port 8080');
|
|
});
|
|
|
|
// Static content
|
|
app.use(express.static(__dirname + '/static'));
|
|
|
|
// Server logic
|
|
io.on('connection', function (socket) {
|
|
console.log('a user connected');
|
|
});
|