summaryrefslogtreecommitdiff
path: root/crates/web
diff options
context:
space:
mode:
Diffstat (limited to 'crates/web')
-rw-r--r--crates/web/Cargo.toml1
-rw-r--r--crates/web/src/main.rs20
2 files changed, 14 insertions, 7 deletions
diff --git a/crates/web/Cargo.toml b/crates/web/Cargo.toml
index 62a3504..2528a0a 100644
--- a/crates/web/Cargo.toml
+++ b/crates/web/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
+argonaut-control = { path = "../control" }
axum = "0.7.5"
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
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();
}