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

16 lines
447 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
2016-10-26 10:43:11 +02:00
2016-06-18 21:53:18 +02:00
const logger = require('../logger');
module.exports = function (app, config) {
2016-06-18 21:53:18 +02:00
app.get('/health', (req, res) => {
config.stores.db.select(1)
.from('features')
2016-11-11 16:24:16 +01: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' });
});
});
};