mirror of
https://github.com/Xevion/dynamic-preauth.git
synced 2025-12-10 08:07:08 -06:00
repo init, simplistic salvo hello world
This commit is contained in:
17
src/main.rs
Normal file
17
src/main.rs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user