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

25 lines
617 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
2016-10-26 10:43:11 +02:00
const logger = require('../logger')('health-check.js');
const { Router } = require('express');
exports.router = function(config) {
const router = Router();
router.get('/', (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' });
});
});
return router;
};