Skip to content

Commit

Permalink
feat: enabled healthcheck for ALB in AWS healthchecks (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-W authored Mar 19, 2019
1 parent af7bfa3 commit 0d05919
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let server = new FHIRServer(SERVER_CONFIG)
.configureMiddleware()
.configurePassport()
.configureHelmet()
.enableHealthCheck()
.setProfileRoutes()
.setErrorRoutes();

Expand Down
10 changes: 10 additions & 0 deletions src/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ class Server {
return this;
}

// enable health check
enableHealthCheck () {
// just send a simple 200 response for healthcheck
this.app.use('/healthcheck', (_req, res) =>
res.status(200).json({ uptime: process.uptime() })
);
// return self for chaining
return this;
}

// Setup profile routes
setProfileRoutes() {
this.logger.info('Loading GraphQL schemas and setting routes');
Expand Down

0 comments on commit 0d05919

Please sign in to comment.