diff --git a/lib/healthcheck.js b/lib/healthcheck.js new file mode 100644 index 000000000..df2af42fe --- /dev/null +++ b/lib/healthcheck.js @@ -0,0 +1,9 @@ +const express = require('express'); +const router = express.Router(); + +module.exports = router; + +router.route('/').get(function (req, res, next) { + // Only check currently is that the webserver is up + res.status(200).json({ ok: true }); +}); diff --git a/lib/webserver.js b/lib/webserver.js index c46dca6d5..4e899943e 100644 --- a/lib/webserver.js +++ b/lib/webserver.js @@ -12,6 +12,7 @@ function main({ key = null, cert = null, port = 7341 } = {}, altPort = null) { app.disable('x-powered-by'); app.use(bodyParser.json()); + app.use('/healthcheck', require('./healthcheck')); if (altPort) { port = altPort; diff --git a/test/functional/healthcheck.test.js b/test/functional/healthcheck.test.js index 4e469aba0..592f337a4 100644 --- a/test/functional/healthcheck.test.js +++ b/test/functional/healthcheck.test.js @@ -46,8 +46,6 @@ test('client healthcheck', t => { process.env.SECRET = 'secret'; process.env.PORT = localPort; process.env.ACCEPT = 'filters.json'; - // process.env.BROKER_URL = `http://localhost:${serverPort}`; - // process.env.BROKER_ID = '12345'; process.env.BROKER_TYPE = 'client'; const client = app.main({ port: port() });