Home Manual Reference Source Test API Healthcheck IssuesPulls

src/controllers/admin.controller.js

  1. /**
  2. * @flow
  3. *
  4. * NOTE: This file will not be included in the esdoc list because it doesn't export any identifiers
  5. */
  6. import { HapiRequest } from '../base/request/hapi-request.interface.js';
  7. import CONFIG from '../helpers/config.helper.js';
  8. import healthcheckHelper from '../helpers/healthcheck.helper.js';
  9.  
  10. /**
  11. * Basic Controller for returning server information
  12. * @param {HapiRequest} request Request Parameters
  13. * @return {Object} Server information Object
  14. */
  15. function infoController(request: HapiRequest): any { // eslint-disable-line
  16. return request.server.info;
  17. }
  18.  
  19. /**
  20. * Basic Controller for returning Healthcheck information
  21. * @param {HapiRequest} request Request Parameters
  22. * @return {Object} Healthcheck response Object
  23. */
  24. function healthcheckController(request: HapiRequest): any { // eslint-disable-line
  25. return healthcheckHelper.getStatus(request.params.level);
  26. }
  27.  
  28. export default [
  29. {
  30. path: `${CONFIG.PATHS.healthcheck}/{level?}`,
  31. method: 'GET',
  32. controller: healthcheckController
  33. },
  34. {
  35. path: CONFIG.PATHS.info,
  36. method: 'GET',
  37. controller: infoController
  38. }
  39. ];