Add health check
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package be.simplenotes.app.controllers
|
||||
|
||||
import be.simplenotes.persistance.DbHealthCheck
|
||||
import org.http4k.core.Request
|
||||
import org.http4k.core.Response
|
||||
import org.http4k.core.Status.Companion.OK
|
||||
import org.http4k.core.Status.Companion.SERVICE_UNAVAILABLE
|
||||
|
||||
class HealthCheckController(private val dbHealthCheck: DbHealthCheck) {
|
||||
fun healthCheck(request: Request) =
|
||||
if (dbHealthCheck.isOk()) Response(OK) else Response(SERVICE_UNAVAILABLE)
|
||||
}
|
||||
Reference in New Issue
Block a user