use std::env::args;

use server::{Appdata, router};
use utils::http;


const DEFAULT_PORT: u16 = 13337;

fn main() -> http::Result<()> {
    let port = args().nth(1).unwrap_or(DEFAULT_PORT.to_string());

    println!("Starting on port {}", port);

    let appdata = Appdata::new();
    http::run(&format!("127.0.0.1:{}", port), appdata, router)?;

    Ok(())
}
