This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/server.js

39 lines
812 B
JavaScript

// libraries
var
http = require('http'),
socketio = require('socket.io'),
express = require('express'),
gulp = global.gulp = require('gulp'),
helmet = require('helmet');
// 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('Node.js listening on port 8080');
});
app.use(helmet());
// Static content
app.use(express.static(__dirname + '/static'));
// Server logic
io.on('connection', function (socket) {
console.log('a user connected');
socket.on('disconnect', function(){
// console.log('user disconnected');
});
socket.on('login', function(msg){
console.log('message:', msg.uname, msg.password);
});
});