remove separate ui service, serve ui with backend
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 10s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 10s
This commit is contained in:
30
src/main.rs
Normal file
30
src/main.rs
Normal file
@ -0,0 +1,30 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use clap::{Parser, command};
|
||||
use nuchat::run;
|
||||
use tracing::{Level, event};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// Host to bind to
|
||||
#[arg(long, default_value = "127.0.0.1")]
|
||||
host: String,
|
||||
|
||||
/// Port to use
|
||||
#[arg(long, default_value_t = 7000)]
|
||||
port: u16,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
let args = Args::parse();
|
||||
let str_address = format!("{}:{}", args.host, args.port);
|
||||
let address: SocketAddr = str_address
|
||||
.parse()
|
||||
.unwrap_or_else(|_| panic!("could not parse address: {str_address}"));
|
||||
let listener = tokio::net::TcpListener::bind(address).await?;
|
||||
let result = run(listener)?.await;
|
||||
event!(Level::INFO, "Server stopped");
|
||||
result
|
||||
}
|
||||
Reference in New Issue
Block a user