I am implementing health check endpoint for my Rocket API like this:
rocket_healthz = "0.2.0"
rocket_healthz::healthz!();
#[launch]
fn rocket() -> _ {
rocket::build()
.mount("/actuator/health", routes![healthz])
}
but when I access the health endpoint using this command:
curl http://127.0.0.1:11014/actuator/health
shows result like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Not Found</title>
</head>
<body align="center">
<div role="main" align="center">
<h1>404: Not Found</h1>
<p>The requested resource could not be found.</p>
<hr />
</div>
<div role="contentinfo" align="center">
<small>Rocket</small>
</div>
</body>
Where am I going wrong? What should I do to fix this problem?
From the documentation, it looks like it adds the /healthz
part itself. So as written, calling the endpoint /actuator/health/healthz
should work.
I do not see a way for you to customize the route if you wanted /health
instead of /healthz
.