aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@gmail.com>2019-02-10 11:17:31 -0500
committerAndrew Lee <alee14498@gmail.com>2019-02-10 11:17:31 -0500
commit1b2ef53aaadd043f590801c50bb0e562fce35a2f (patch)
treea64275303e5d9435ad5883882d37cabe8d1c23c3 /index.js
parentb171a6b0e5386b62fbfd45018d46fbf199aeaf1c (diff)
downloadProject-Hexus-1b2ef53aaadd043f590801c50bb0e562fce35a2f.tar.gz
Project-Hexus-1b2ef53aaadd043f590801c50bb0e562fce35a2f.tar.bz2
Project-Hexus-1b2ef53aaadd043f590801c50bb0e562fce35a2f.zip
getting the basics
Diffstat (limited to 'index.js')
-rw-r--r--index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..e92075b
--- /dev/null
+++ b/index.js
@@ -0,0 +1,21 @@
+var app = require('express')();
+var http = require('http').Server(app);
+var io = require('socket.io')(http);
+
+app.get('/', function(req, res){
+ res.sendFile('client/index.html');
+});
+
+io.on('connection', function(socket){
+ console.log('user connected');
+ socket.on('chat message', function(msg){
+ io.emit('chat message', msg);
+ });
+ socket.on('disconnect', function(){
+ console.log('user disconnected');
+ });
+});
+
+http.listen(3000, function(){
+ console.log('listening on *:3000');
+}); \ No newline at end of file