api/src/main.rs

31 lines
600 B
Rust
Raw Normal View History

mod api;
use anyhow::Result;
use clap::Parser;
use log::info;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Sets the port on which the API listens
#[arg(short, long)]
port: Option<u16>,
}
#[tokio::main]
async fn main() -> Result<()> {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
let args = Args::parse();
info!("Starting NerdcultAPI v0.1");
let mut port: u16 = 8080;
if let Some(p) = args.port {
port = p;
}
api::start(port).await?;
Ok(())
}