forked from volumio/Volumio2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·38 lines (28 loc) · 1.02 KB
/
index.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
var argv = require('yargs').argv;
if (argv.d) {
var njstrace = require('njstrace').inject();
}
var expressInstance = require('./http/index.js');
var expressApp = expressInstance.app;
// Using port 3000 for the debug interface
expressApp.set('port', 3000);
var httpServer = expressApp.listen(expressApp.get('port'), function() {
console.log('Express server listening on port ' + httpServer.address().port);
});
var albumart=require(__dirname+'/app/plugins/miscellanea/albumart/albumart.js');
albumart.setFolder('/data/albumart');
expressApp.get('/albumart', albumart.processExpressRequest);
expressApp.use(function(err, req, res, next) {
/**
* Replace with Winston logging
**/
console.log('An internal error occurred while serving an albumart. Details: '+err.stack);
/**
* Sending back error code 500
**/
res.sendFile(__dirname+'/app/plugins/miscellanea/albumart/default.png');
});
var commandRouter = new (require('./app/index.js'))(httpServer);
expressApp.get('/?*', function (req, res) {
res.redirect('/');
});