-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
53 lines (47 loc) · 1.38 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
/**
* .d8888b. 888 888
* d88P Y88b 888 888
* 888 888 888 888
* 88888b. .d88b. 888 88888b. 8888b. 888888
* 888 "88b d88P"88b 888 888 "88b "88b 888
* 888 888 888 888 888 888 888 888 .d888888 888
* 888 888 Y88b 888 Y88b d88P 888 888 888 888 Y88b.
* 888 888 "Y88888 "Y8888P" 888 888 "Y888888 "Y888
* 888
* Y8b d88P A simple chat
* "Y88P"
*/
/**
* Require dependencies
*/
var app = module.exports = require('express')();
var http = require('http');
var server = http.createServer(app);
/**
* Require our files
*/
var appManager = require('./utils/appManager');
var routeManager = require('./utils/routeManager');
var socketManager = require('./utils/socketManager');
var conf = require('./public/javascripts/conf').Conf;
/**
* App configuration
*/
appManager.configure(app);
/**
* Routes
*/
routeManager.init(app);
/**
* Configure socket.io and
* create a socket on a client connection
*/
socketManager.configure(server);
/**
* Launch server
*/
var port = process.env.PORT || conf.port;
server.listen(port, function() {
console.log("ngChat is ready, you can chat at http://%s:%d",
server.address().address, server.address().port);
});