1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/packages/unleash-api/lib/routes/health-check.js

17 lines
472 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
const logger = require('../logger');
module.exports = function (app, config) {
2016-06-18 21:53:18 +02:00
app.get('/health', (req, res) => {
config.db.select(1)
.from('features')
2016-06-18 21:53:18 +02:00
.then(() => {
res.json({ health: 'GOOD' });
})
2016-06-18 21:53:18 +02:00
.catch(err => {
logger.error('Could not select from features, error was: ', err);
res.status(500).json({ health: 'BAD' });
});
});
};