use axum::{Router, routing::get};
use std::sync::Arc;
use tray_wrapper::{ContinueRunning, ServerGeneratorResult, create_tray_wrapper};
async fn root() -> &'static str {
"Hello, World!"
}
fn main() -> anyhow::Result<()> {
fn sg() -> ServerGeneratorResult {
let task = async {
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();
ContinueRunning::Continue
};
Box::pin(task)
}
create_tray_wrapper(
include_bytes!("../examples/example_icon.png"),
None,
Arc::new(&sg),
)?;
Ok(())
}