pathfix
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -10,6 +10,13 @@ use tokio::task::JoinHandle;
|
||||
|
||||
mod data;
|
||||
|
||||
macro_rules! log {
|
||||
($($arg:tt)*) => {{
|
||||
let timestamp = Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
|
||||
println!("[{}] {}", timestamp, format_args!($($arg)*));
|
||||
}};
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct AppState {
|
||||
tasks: Arc<Mutex<HashMap<String, JoinHandle<()>>>>,
|
||||
@@ -115,13 +122,12 @@ async fn main() -> std::io::Result<()> {
|
||||
tasks: tasks.clone(),
|
||||
redis: client.clone(),
|
||||
};
|
||||
println!("Redis client initialized");
|
||||
log!("Redis client initialized");
|
||||
HttpServer::new(move || {
|
||||
println!("Webserver initialized");
|
||||
log!("Webserver initialized");
|
||||
App::new()
|
||||
.app_data(web::Data::new(state.clone()))
|
||||
.route("/connect", web::get().to(connect_handler))
|
||||
.route("/disconnect", web::get().to(disconnect_handler))
|
||||
.route("/", web::get().to(connect_handler))
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
|
Reference in New Issue
Block a user