Skip to content

Commit

Permalink
add some basic landing page html
Browse files Browse the repository at this point in the history
  • Loading branch information
tizz98 committed Aug 13, 2023
1 parent 731b56c commit 13744e9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use axum::response::Html;
use axum::{extract::State, response::IntoResponse, routing::get, Json, Router};
use jwtk::{
jwk::{JwkSet, WithKid},
Expand Down Expand Up @@ -38,6 +39,7 @@ async fn main() -> jwtk::Result<()> {
let state = Arc::new(AppState { jwks });

let app = Router::new()
.route("/", get(home))
.route("/.well-known/jwks.json", get(jwks_handler))
.with_state(state);

Expand All @@ -52,3 +54,21 @@ async fn main() -> jwtk::Result<()> {
async fn jwks_handler(State(state): State<Arc<AppState>>) -> impl IntoResponse {
Json(&state.jwks).into_response()
}

async fn home() -> impl IntoResponse {
Html(
r#"
<html>
<head>
<title>XQR Code Server Demo</title>
<style>body{text-align:center}</style>
</head>
<body>
<p>This is a demo server for eXtended QR (XQR) Codes.</p>
<p>See <a href="https://github.com/xqr-dev/xqr-server">GitHub</a> for more information.</p>
</body>
</html>
"#
.to_string(),
)
}

0 comments on commit 13744e9

Please sign in to comment.