1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

Health check should verify that it can talk to the toggle-store (aka DB).

This commit fixes #103 by doing a simple select against the features table.
This commit is contained in:
giacung 2015-10-02 13:46:03 +02:00
parent df66df2f5c
commit 1212e6b266

View File

@ -1,7 +1,18 @@
var knex = require('./dbPool');
var logger = require('./logger');
module.exports = function (app) {
app.get('/health', function (req, res) {
res.json({health: 'GOOD'});
knex.select(1)
.from('features')
.then(function() {
res.json({health: 'GOOD'});
})
.catch(function(err) {
logger.error('Could not select from features, error was: ', err);
res.status(500).json({health: 'BAD'});
});
});
};
};