-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalive.js
More file actions
34 lines (25 loc) · 752 Bytes
/
alive.js
File metadata and controls
34 lines (25 loc) · 752 Bytes
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
module.exports = function setup(options, imports, register) {
var alive = false;
imports.hub.on("ready", function() {
alive = true;
});
function checkAlive(req, res) {
// TODO: Perform internal check to verify that process is still operating properly.
if (alive) {
res.end("OK");
}
else {
res.writeHead(500);
res.end("FAIL");
}
}
imports.connect.useStart(imports.connect.getModule().router(function(app) {
app.get(/^\/alive$/, function(req, res) {
checkAlive(req, res);
});
app.post(/^\/alive$/, function(req, res) {
checkAlive(req, res);
});
}));
register(null, {});
};