added root
This commit is contained in:
parent
e2a28d43f0
commit
4288d979fc
1 changed files with 9 additions and 2 deletions
|
@ -52,7 +52,8 @@ async fn main() -> Result<()>{
|
||||||
|
|
||||||
|
|
||||||
let app: Router = Router::new()
|
let app: Router = Router::new()
|
||||||
.route("/names", get(root))
|
.route("/names", get(names))
|
||||||
|
.route("/", get(root))
|
||||||
.route("/admin", get(control))
|
.route("/admin", get(control))
|
||||||
.route("/phil", get(phil))
|
.route("/phil", get(phil))
|
||||||
.route("/recent", get(recent_badge))
|
.route("/recent", get(recent_badge))
|
||||||
|
@ -130,7 +131,13 @@ async fn get_recent_badge(fish: Arc<Semaphore>) -> Result<u64> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn root(state: State<AppState>) -> Html<String> {
|
async fn root() -> Html<String> {
|
||||||
|
let page = format!(r#"
|
||||||
|
<h1>JOHN</h1>
|
||||||
|
"#);
|
||||||
|
Html::from(page)
|
||||||
|
}
|
||||||
|
async fn names(state: State<AppState>) -> Html<String> {
|
||||||
let (last_badge, time) = *state.last_badge.read().await;
|
let (last_badge, time) = *state.last_badge.read().await;
|
||||||
let time = time.elapsed();
|
let time = time.elapsed();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue