summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 5faed73b7f4b514905f201d1e59c02402825f857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use axum::{Router, routing::get};

const BANNER: &str = r#"
          ######   ######   ######  
         ##    ## ##    ## ##    ## 
         ##       ##       ##       
         ##       ##       ##       
         ##       ##       ##       
         ##    ## ##    ## ##    ## 
          ######   ######   ######  

          Closed Circuit Consulting
               Twin Cities, MN            
  
  https://git.closedcircuitconsulting.com
  https://github.com/closedcircuitconsulting

"#;

#[tokio::main]
async fn main() {
    let app = Router::new().route("/", get(|| async { BANNER }));
    let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
    let server_handle = tokio::spawn(async move { axum::serve(listener, app).await });
    tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
    if !server_handle.is_finished() {
        let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Ready]);
    }

    server_handle.await.unwrap().unwrap();
}