File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import express from 'express'
2+
3+ const router = express . Router ( )
4+
5+ /**
6+ * Returns the healthiness of the service.
7+ * This may be used by azure app service (forthcoming) to determine whether this
8+ * instance remains in the pool to handle requests
9+ * For example: if we have a failing database connection we may return a 500 status here.
10+ */
11+ router . get ( '/' , function healthz ( req , res , next ) {
12+ res . set ( {
13+ 'surrogate-control' : 'private, no-store' ,
14+ 'cache-control' : 'private, no-store' ,
15+ } )
16+
17+ res . sendStatus ( 200 )
18+ } )
19+
20+ export default router
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import blockRobots from './block-robots.js'
3838import archivedEnterpriseVersionsAssets from './archived-enterprise-versions-assets.js'
3939import events from './events.js'
4040import search from './search.js'
41+ import healthz from './healthz.js'
4142import archivedEnterpriseVersions from './archived-enterprise-versions.js'
4243import robots from './robots.js'
4344import earlyAccessLinks from './contextualizers/early-access-links.js'
@@ -182,6 +183,7 @@ export default function (app) {
182183 // *** Rendering, 2xx responses ***
183184 app . use ( '/events' , asyncMiddleware ( instrument ( events , './events' ) ) )
184185 app . use ( '/search' , asyncMiddleware ( instrument ( search , './search' ) ) )
186+ app . use ( '/healthz' , asyncMiddleware ( instrument ( healthz , './healthz' ) ) )
185187
186188 // Check for a dropped connection before proceeding (again)
187189 app . use ( haltOnDroppedConnection )
You can’t perform that action at this time.
0 commit comments