Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
Latest commit
70 lines (58 loc) · 1.77 KB
/
Copy pathindex.js
File metadata and controls
70 lines (58 loc) · 1.77 KB
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
64
65
66
67
68
69
70
/*!
* app.js is the server component of slippery
*
* @author pfleidi
*/
varExpress=require('express');
varLog4js=require('log4js');
varFs=require('fs');
varWebSocket=require('./lib/websocket.js');
varMemoryStore=Express.session.MemoryStore;
varsessionStore=newMemoryStore();
varPORT=8080;
varLOGFILE=__dirname+'/log/slideshow.log';
varCONTROLLERS_FOLDER=__dirname+"/controllers/";
varlogger=Log4js.getLogger('slideshow');
/*
* set up the application
*/
varapp=module.exports=Express.createServer();
app.configure(function(){
app.use(Express.cookieParser());
app.use(Express.session({
store: sessionStore,
key: 'slides.uid',
secret: 'fljkasaskjfhdaskjf'
}));
app.use(Express.static(__dirname+'/public'));
app.use(app.router);
});
app.configure('development',function(){
app.use(Express.errorHandler({
dumpExceptions: true,
showStack: true
}));
logger.setLevel('DEBUG');
});
app.configure('production',function(){
varaccessLog=Fs.createWriteStream(__dirname+'/logs/access.log',{
encoding: 'utf-8',
flags: 'a'
});
app.use(Express.logger({stream: accessLog}));
app.use(Express.errorHandler());
Log4js.addAppender(Log4js.fileAppender(LOGFILE));
logger.setLevel('ERROR');
});
vario=require('socket.io').listen(app);
WebSocket.handleSockets(io,logger,sessionStore);
(functioninitControllers(){
Fs.readdirSync(CONTROLLERS_FOLDER).forEach(function(file){
if(/\.js$/.test(file)){
require(CONTROLLERS_FOLDER+file).register(app);
}
});
}());
app.listen(PORT,function(){
logger.info('Server listening on port: http://localhost:'+PORT);
});