Added webserver and port number specification
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -1,8 +1,19 @@
|
||||
use axum::Router;
|
||||
use tokio::net::TcpListener;
|
||||
use axum::routing::get;
|
||||
|
||||
mod argparse;
|
||||
mod print_dir;
|
||||
|
||||
fn main() {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = argparse::parse_args();
|
||||
println!("{:#?}", args);
|
||||
print_dir::print_interface(&args.interface, &args.directory);
|
||||
print_dir::print_interface(&args.interface, &args.port, &args.directory);
|
||||
|
||||
let app = Router::new().route("/", get(|| async { "Hello world!" }));
|
||||
let listener = TcpListener::bind(format!("0.0.0.0:{}", args.port))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user