UNPKG

@piggly/fastify-chassis

Version:

An ESM/CommonJS toolkit to help you to do common operations in your back-end applications with Fastify and NodeJS.

24 lines 833 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthCheckRoute = void 0; /** * Health check route. * * It will run the health check service and return the result. * If success, it will return 200. Otherwise, it will return 503. * * The response will be a JSON object with the following properties: * - [service]: boolean * * @param {Object} deps * @param {HealthCheckService} deps.HEALTH_CHECK_SERVICE * @returns Route handler. * @since 7.0.0 * @author Caique Araujo <caique@piggly.com.br> */ const HealthCheckRoute = (deps) => async (request, reply) => { const response = await deps.HEALTH_CHECK_SERVICE.check(); return reply.status(response.success ? 200 : 503).send(response); }; exports.HealthCheckRoute = HealthCheckRoute; //# sourceMappingURL=HealthCheckRoute.js.map