Skip to content

Commit

Permalink
feat: basic html info response for notary server's root endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
heeckhau committed Feb 14, 2024
1 parent 309c37f commit 65eb864
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion notary-server/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use axum::{
http::{Request, StatusCode},
middleware::from_extractor_with_state,
response::IntoResponse,
response::{Html, IntoResponse},
routing::{get, post},
Json, Router,
};
Expand Down Expand Up @@ -111,7 +111,23 @@ pub async fn run_server(config: &NotaryServerProperties) -> Result<(), NotarySer
let git_commit_hash = env!("GIT_COMMIT_HASH").to_string();
let git_commit_timestamp = env!("GIT_COMMIT_TIMESTAMP").to_string();

let html_info = Html(format!(
r#"<h1>TLSNotary server {}!</h1>
<ul>
<li>git commit hash: <a href="https://github.com/tlsnotary/tlsn/commit/{}">{}</a></li>
<li>git commit timestamp: {}</li>
<li>public key: <pre>{}</pre></li>
</ul>
<a href="/healthcheck">health check</a> - <a href="/info">info</a><br/>
"#,
&version, &git_commit_hash, &git_commit_hash, &git_commit_timestamp, &public_key
));

let router = Router::new()
.route(
"/",
get(|| async move { (StatusCode::OK, html_info).into_response() }),
)
.route(
"/healthcheck",
get(|| async move { (StatusCode::OK, "Ok").into_response() }),
Expand Down

0 comments on commit 65eb864

Please sign in to comment.