From 1cf2f61bfb03f60cbd5855eca47c539cad841b4a Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 31 May 2019 23:20:00 +0000 Subject: [PATCH] [CORL-388] Health Check (#2336) * feat: added prelim health-check endpoint * Update health.ts * Update health.ts * fix: lint --- src/core/server/app/handlers/api/health.ts | 5 +++++ src/core/server/app/handlers/api/index.ts | 1 + src/core/server/app/router/api/index.ts | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 src/core/server/app/handlers/api/health.ts diff --git a/src/core/server/app/handlers/api/health.ts b/src/core/server/app/handlers/api/health.ts new file mode 100644 index 000000000..116e60ee7 --- /dev/null +++ b/src/core/server/app/handlers/api/health.ts @@ -0,0 +1,5 @@ +import { RequestHandler } from "express"; + +export const healthHandler: RequestHandler = (req, res, next) => { + res.status(200).send("OK"); +}; diff --git a/src/core/server/app/handlers/api/index.ts b/src/core/server/app/handlers/api/index.ts index 3bfd9e278..77483fb81 100644 --- a/src/core/server/app/handlers/api/index.ts +++ b/src/core/server/app/handlers/api/index.ts @@ -1,5 +1,6 @@ export * from "./account"; export * from "./auth"; export * from "./graphql"; +export * from "./health"; export * from "./install"; export * from "./version"; diff --git a/src/core/server/app/router/api/index.ts b/src/core/server/app/router/api/index.ts index 49b9db8b6..96ec8d626 100644 --- a/src/core/server/app/router/api/index.ts +++ b/src/core/server/app/router/api/index.ts @@ -4,6 +4,7 @@ import passport from "passport"; import { AppOptions } from "coral-server/app"; import { graphQLHandler, + healthHandler, installHandler, versionHandler, } from "coral-server/app/handlers"; @@ -32,6 +33,9 @@ export function createAPIRouter(app: AppOptions, options: RouterOptions) { // Configure the version route. router.get("/version", versionHandler); + // Configure the Health route. + router.get("/health", healthHandler); + // Installation middleware. router.use( "/install",