kochab/examples/serve_dir.rs
Emi Tatsuo 63c228bcfa
Replace molly brown w/ stargazer, serve examples in IP
Stargazer is available thru cargo, which makes it more accessable to new users.  Serving ip allows examples to be run in gemini_srv mode
2020-12-13 19:53:18 -05:00

19 lines
471 B
Rust

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