A quick HTTP fileserver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
614 B

use std::path::PathBuf;
use structopt::StructOpt;
/// A basic example
#[derive(StructOpt, Debug)]
#[structopt(name = "quickserv")]
struct Opt {
// The HTTP port to listen on
#[structopt(short, long, env="PORT", default_value="9001")]
port: u16,
// The path to serve
#[structopt(short, long, env="DIR", default_value=".")]
dir: PathBuf,
async fn main() {
let opt = Opt::from_args();
log::info!("serving {:?} on port {}", opt.dir, opt.port);
.run(([0, 0, 0, 0], opt.port))