-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (34 loc) · 1.16 KB
/
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
41
42
43
44
45
46
47
var express = require('express');
var config = require('./config/test_config')();
// Includign mongodb library
var mongoose = require('mongoose');
mongoose.connect(config.getMongodbConnUrl('localhost', 'dbworkplz'));
var app = express();
/* App configuration */
app.set('view engine', 'jade');
app.set('views',
[
'.application/common/views',
'./application/default/views',
'./application/test/views'
]
);
app.use(express.static('./public'));
var server = require('http').Server(app);
var io = require('socket.io')(server);
server.listen(3020);
app.get('/', function(req, res) {
res.send('Hello world again, using nodemon & socket now.. :)!');
});
// var events = require('./routes/events');
var defaultEvents = require('./routes/default_events');
// app.use('/events', events);
app.use('/de', defaultEvents);
/* Using socket.io integration now. */
// var server = app.listen(3014, function(err) {
// console.log('Example app listening..');
// });
/* Testing socketio basic features */
var nmsp1 = io.of('/nmsp1').on('connection', function(socket) {
nmsp1.emit('def_ns_testing_ch', 'This is a test message emitted to everyone.');
});