aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..60f2214
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,43 @@
1use axum::{Router, routing::post};
2use time::util::local_offset;
3use tracing::{info, level_filters::LevelFilter};
4use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*};
5use crate::routes::start::start;
6
7mod auth;
8mod routes;
9
10#[tokio::main]
11async fn main() {
12
13 unsafe { local_offset::set_soundness(local_offset::Soundness::Unsound); }
14 let time_format =
15 time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
16 let loc = LocalTime::new(time_format);
17
18 tracing_subscriber::registry()
19 .with(fmt::layer()
20 .with_timer(loc)
21 )
22 .with(
23 EnvFilter::builder()
24 .with_default_directive(LevelFilter::INFO.into())
25 .from_env_lossy(),
26 )
27 .init();
28
29 let version = env!("CARGO_PKG_VERSION");
30
31 info!("Starting webol v{}", version);
32
33 // build our application with a single route
34 let app = Router::new()
35 .route("/start", post(start));
36
37 // run it with hyper on localhost:3000
38 axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
39 .serve(app.into_make_service())
40 .await
41 .unwrap();
42}
43