-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
47 lines (36 loc) · 1.04 KB
/
app.js
File metadata and controls
47 lines (36 loc) · 1.04 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
global.__base = __dirname;
let express = require('express');
let config = require('./config/config');
let RAIDController = require('./lib/RAIDController');
let controller = new RAIDController(config);
let app = express();
app.use(express.static('public'));
app.set('view engine', 'jade');
app.set('views', __dirname + '/views/pages');
app.get(/raidberry\/synchronize$/, function (req, res) {
let raid = controller.getRAID(config);
if (false !== raid) {
raid.synchronize();
res.send('cool, synchronizing stuff!');
}
else {
res.send('did not work, sorry for that!');
}
});
app.get(/raidberry\/status$/, function (req, res) {
let raid = controller.getRAID(config);
if (false !== raid) {
raid.status(function (code, stdout) {
res.send(stdout);
});
}
else {
res.send('no status available!');
}
});
app.get('*', function (req, res) {
res.send('hey, world');
});
app.listen(1234, function () {
console.log('server started, listening on port ' + 1234);
});