summaryrefslogtreecommitdiff
path: root/crates/web/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/web/src')
-rw-r--r--crates/web/src/main.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/crates/web/src/main.rs b/crates/web/src/main.rs
index f641ce0..d80b232 100644
--- a/crates/web/src/main.rs
+++ b/crates/web/src/main.rs
@@ -1,17 +1,23 @@
-use axum::{
- http::StatusCode,
- routing::{get, post},
- Json, Router,
-};
-use serde::{Deserialize, Serialize};
+use std::sync::Arc;
+
+use axum::{routing::get, Router};
+
+pub use argonaut_control::Handle as PrinterThread;
+use tracing::info;
#[tokio::main(flavor = "current_thread")]
async fn main() {
tracing_subscriber::fmt::init();
- let app = Router::new().route("/", get(root));
+ let printer_thread = PrinterThread::spawn();
+ let printer_thread = Arc::new(printer_thread);
+ let app = Router::new()
+ .route("/", get(root))
+ .with_state(printer_thread);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
+
+ info!("init completed, listening");
axum::serve(listener, app).await.unwrap();
}