repo init, simplistic salvo hello world

This commit is contained in:
2024-12-21 21:05:53 -06:00
commit cc3d1759a7
5 changed files with 2536 additions and 0 deletions

17
src/main.rs Normal file
View File

@@ -0,0 +1,17 @@
use salvo::prelude::*;
#[handler]
async fn hello() -> &'static str {
"Hello World"
}
#[tokio::main]
async fn main() {
let port = std::env::var("PORT").unwrap_or_else(|_| "5800".to_string());
let addr = format!("127.0.0.1:{}", port);
tracing_subscriber::fmt().init();
let router = Router::new().get(hello);
let acceptor = TcpListener::new(addr).bind().await;
Server::new(acceptor).serve(router).await;
}