summaryrefslogtreecommitdiff
path: root/crates/web/src
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-09-08 18:46:42 +0100
committertcmal <me@aria.rip>2024-09-08 18:46:42 +0100
commitddc97e9361137fde6f0894ffa729d285159662fa (patch)
tree33f3f54a70a732374312ebde8b0b56a7e8cae1a1 /crates/web/src
Add web crate based on axum
Diffstat (limited to 'crates/web/src')
-rw-r--r--crates/web/src/main.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/web/src/main.rs b/crates/web/src/main.rs
new file mode 100644
index 0000000..f641ce0
--- /dev/null
+++ b/crates/web/src/main.rs
@@ -0,0 +1,20 @@
+use axum::{
+ http::StatusCode,
+ routing::{get, post},
+ Json, Router,
+};
+use serde::{Deserialize, Serialize};
+
+#[tokio::main(flavor = "current_thread")]
+async fn main() {
+ tracing_subscriber::fmt::init();
+
+ let app = Router::new().route("/", get(root));
+
+ let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
+ axum::serve(listener, app).await.unwrap();
+}
+
+async fn root() -> &'static str {
+ "Hello, World!"
+}