kochab/examples/serve_dir.rs
Emii Tatsuo b69aba139f
Rebrand as kochab
I spent /so/ long looking for that figlet font.
    __              __          __
   / /______  _____/ /_  ____ _/ /_
  / //_/ __ \/ ___/ __ \/ __ `/ __ \
 / ,< / /_/ / /__/ / / / /_/ / /_/ /
/_/|_|\____/\___/_/ /_/\__,_/_.___/
2020-11-25 00:42:09 -05:00

19 lines
494 B
Rust

use std::path::PathBuf;
use anyhow::*;
use log::LevelFilter;
use kochab::{Server, GEMINI_PORT};
#[tokio::main]
async fn main() -> Result<()> {
env_logger::builder()
.filter_module("kochab", LevelFilter::Debug)
.init();
Server::bind(("localhost", GEMINI_PORT))
.add_route("/", PathBuf::from("public")) // Serve directory listings & file contents
.add_route("/about", PathBuf::from("README.md")) // Serve a single file
.serve()
.await
}