2016-04-28 16:58:59 +02:00
|
|
|
var logger = require('../logger');
|
2015-10-02 13:46:03 +02:00
|
|
|
|
2016-05-01 22:53:09 +02:00
|
|
|
module.exports = function (app, config) {
|
2014-10-20 13:03:43 +02:00
|
|
|
app.get('/health', function (req, res) {
|
2016-05-01 22:53:09 +02:00
|
|
|
config.db.select(1)
|
2015-10-02 13:46:03 +02:00
|
|
|
.from('features')
|
|
|
|
.then(function() {
|
2016-04-24 22:41:37 +02:00
|
|
|
res.json({ health: 'GOOD' });
|
2015-10-02 13:46:03 +02:00
|
|
|
})
|
|
|
|
.catch(function(err) {
|
|
|
|
logger.error('Could not select from features, error was: ', err);
|
2016-04-24 22:41:37 +02:00
|
|
|
res.status(500).json({ health: 'BAD' });
|
2015-10-02 13:46:03 +02:00
|
|
|
});
|
2014-10-20 13:03:43 +02:00
|
|
|
});
|
2015-10-02 13:46:03 +02:00
|
|
|
};
|