Commit 06775f8b authored by Juha's avatar Juha

Simple health-check API added

parent a9a34fbc
Pipeline #24530981 passed with stage
const request = require('supertest');
const db = require('../../../models/sequelize');
const app = require('../../app');
describe('Get /health-check API tests', () => {
afterAll(() => {
app.close();
db.sequelize.close();
});
test('Should return success for #get /health-check', async () => {
const response = await request.agent(app)
.get('/health-check');
expect(response.statusCode).toBe(200);
});
});
const db = require('../../../models/sequelize');
const getHealthCheck = async (req, res, next) => {
await db.sequelize.authenticate();
res.send(200);
return next();
};
module.exports = getHealthCheck;
const restifyAsyncWrap = require('@gilbertco/restify-async-wrap');
const getHealthCheck = require('./get');
module.exports = (server) => {
server.get('/health-check', restifyAsyncWrap(getHealthCheck));
};
/* eslint-disable global-require */
module.exports = function (server) {
require('./health-check')(server);
require('./login')(server);
require('./protected')(server);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment