added smaller test data and started setting up the serving of htmx via axum.
This commit is contained in:
parent
37eacffaef
commit
a87ae3dcd3
3 changed files with 182 additions and 102 deletions
|
|
@ -7,6 +7,7 @@ use std::sync::Arc;
|
|||
pub async fn run_metrics_server(addr: SocketAddr, registry: Arc<Registry>) {
|
||||
let app = Router::new()
|
||||
.route("/", get(root))
|
||||
.route("/health", get(|| async { "OK" }))
|
||||
.route("/metrics", get(move || {
|
||||
let registry = Arc::clone(®istry);
|
||||
async move {
|
||||
|
|
@ -31,10 +32,35 @@ async fn root() -> http::Response<hyper::Body> {
|
|||
<html>
|
||||
<head>
|
||||
<title>Library</title>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to the SK Collectors Companion</h1>
|
||||
<h1 >Welcome to the SK Collectors Companion</h1>
|
||||
<p id="data">Click the button below to get the metrics</p>
|
||||
<br />
|
||||
<button id="submit" hx-get="/metrics" hx-target='#data' hx-swap="innerHTML">Get Data</button>
|
||||
</body>
|
||||
<style>
|
||||
body {
|
||||
background-color: #3d3d3d;
|
||||
}
|
||||
h1 {
|
||||
color: white;
|
||||
}
|
||||
#data {
|
||||
color: white;
|
||||
}
|
||||
#submit {
|
||||
background-color: #4CAF50;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 32px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
</html>
|
||||
"#;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue