-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
40 lines (24 loc) · 821 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var express = require('express');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var socketio = require('socket.io');
var app = express();
app.use(express.static(__dirname + '/public'));
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({'extended':'true'}));
app.use(bodyParser.json());
app.use(bodyParser.json({ type: 'application/vd.api+json'}));
var port = 8080;
var server = app.listen(port, function() {
console.log('Server listening on port', port);
});
var io = socketio.listen(server);
app.use('/', require('./routes/routes.js')(io));
// io.on('connection', function(socket){
// socket.emit('message', {'message': 'hello world'});
// });
//serve root
// io.on('connection', function(socket) {
// console.log('someone has connected');
//
module.exports = app;