forked from linnovate/mean-socket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
63 lines (49 loc) · 1.75 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'use strict';
var mean = require('meanio');
/**
* Defining the Package
*/
var Module = mean.Module;
var MeanSocket = new Module('mean-socket');
/**
* All MEAN packages require registration
* Dependency injection is used to define required modules
*/
MeanSocket.register(function(app, auth, database, https) {
var io = require('socket.io').listen(https);
console.log('Chat now listening on port:', MeanSocket.config.clean.https.port);
mean.register("io", function(){
return io;
});
//We enable routing. By default the Package Object is passed to the routes
MeanSocket.routes(app, auth, database, io);
//We are adding a link to the main menu for all authenticated users
// MeanSocket.menus.add({
// title: 'Mean socket help page',
// link: 'Mean socket help page',
// roles: ['authenticated'],
// menu: 'main'
// });
// //Uncomment to use. Requires meanio@0.3.7 or above
// // Save settings with callback
// // Use this for saving data from administration pages
// MeanSocket.settings({
// 'someSetting': 'some value'
// }, function(err, settings) {
// //you now have the settings object
// });
// Another save settings example this time with no callback
// This writes over the last settings.
MeanSocket.settings({
'funcPage': '../controllers/sockets',
'getMessageFunc': 'createFromSocket',
'getAllMessagesFunc': 'getAllForSocket',
'removeOldMessagesFunc': 'removeOldSocketMessages',
'getAllChannelsFunc': 'getListOfChannels'
});
// // Get settings. Retrieves latest saved settigns
// MeanSocket.settings(function(err, settings) {
// //you now have the settings object
// });
return MeanSocket;
});