summaryrefslogtreecommitdiff
path: root/crates/web/src/main.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-09-08 18:46:43 +0100
committertcmal <me@aria.rip>2024-09-12 16:30:09 +0100
commit9a7042df7f9a7ad0324c4442ae918c2a4a442966 (patch)
tree81324f03df3ddaac9db7d1e01ef5b319bef659ef /crates/web/src/main.rs
parentddc97e9361137fde6f0894ffa729d285159662fa (diff)
Add framework for separate printer control thread
Diffstat (limited to 'crates/web/src/main.rs')
-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();
}