Disabling Logging for Specific Routes in HTTP Server

With the HTTP server, is there a recommended way to disable logging for certain routes? I have a health check endpoint and want to avoid it polluting my logs. Tried to create a main app and a health check router and mount them on an empty router like below, but it doesn't work when the app needs to be mounted at the root:

const app = HttpServer.router.empty.pipe(
  HttpServer.router.get('/', HttpServer.response.text('hello from app')),
  HttpServer.middleware.logger,
)

const healthCheck = HttpServer.router.empty.pipe(
  HttpServer.router.get('/health', HttpServer.response.text('ok')),
)

const serve = HttpServer.router.empty
  .pipe(
    HttpServer.router.mountApp('/', app),
    HttpServer.router.mount('/', healthCheck),
  )
  .pipe(HttpServer.server.serve())
Was this page helpful?