2016-06-18 21:53:18 +02:00
|
|
|
'use strict';
|
|
|
|
const logger = require('../logger');
|
2015-10-02 13:46:03 +02:00
|
|
|
|
2016-05-01 22:53:09 +02:00
|
|
|
module.exports = function (app, config) {
|
2016-06-18 21:53:18 +02:00
|
|
|
app.get('/health', (req, res) => {
|
2016-05-01 22:53:09 +02:00
|
|
|
config.db.select(1)
|
2015-10-02 13:46:03 +02:00
|
|
|
.from('features')
|
2016-06-18 21:53:18 +02:00
|
|
|
.then(() => {
|
2016-04-24 22:41:37 +02:00
|
|
|
res.json({ health: 'GOOD' });
|
2015-10-02 13:46:03 +02:00
|
|
|
})
|
2016-06-18 21:53:18 +02:00
|
|
|
.catch(err => {
|
2015-10-02 13:46:03 +02:00
|
|
|
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
|
|
|
};
|