Skip to content

Commit

Permalink
Merge pull request #46 from bytes-zone/health-endpoint
Browse files Browse the repository at this point in the history
health endpoint
  • Loading branch information
BrianHicks authored Jan 5, 2025
2 parents 5c79d9f + a6fa773 commit 1b8d05a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.4.2 (2025-01-04)

Add a `/health` endpoint to the server for healthchecks in environments like Kubernetes.

This release is available as a container image at `ghcr.io/bytes-zone/beeps:v0.4.2`.

## 0.4.1 (2025-01-04)

Version updates for all packages. The server is now available as a container image now, too! You can find it at `ghcr.io/bytes-zone/beeps:v0.4.1`.
Expand Down
1 change: 1 addition & 0 deletions beeps-server/src/handlers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![expect(clippy::missing_docs_in_private_items)]

pub mod health;
pub mod login;
pub mod register;
pub mod whoami;
Expand Down
14 changes: 14 additions & 0 deletions beeps-server/src/handlers/health.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#[tracing::instrument]
pub async fn handler() -> &'static str {
"OK"
}

#[cfg(test)]
mod test {
use super::*;

#[test_log::test(tokio::test)]
async fn test_success() {
assert_eq!(handler().await, "OK")
}
}
1 change: 1 addition & 0 deletions beeps-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ async fn main() {

let app = Router::new()
// ROUTES
.route("/health", get(handlers::health::handler))
.route("/api/v1/register", post(handlers::register::handler))
.route("/api/v1/login", post(handlers::login::handler))
.route("/api/v1/whoami", get(handlers::whoami::handler))
Expand Down

0 comments on commit 1b8d05a

Please sign in to comment.