2020-11-24 22:22:47 +00:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2020-10-31 19:53:03 +00:00
|
|
|
use anyhow::*;
|
2020-11-14 02:56:50 +00:00
|
|
|
use log::LevelFilter;
|
2020-11-25 05:42:09 +00:00
|
|
|
use kochab::{Server, GEMINI_PORT};
|
2020-10-31 19:53:03 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
2020-11-14 02:56:50 +00:00
|
|
|
env_logger::builder()
|
2020-11-25 05:42:09 +00:00
|
|
|
.filter_module("kochab", LevelFilter::Debug)
|
2020-11-14 02:56:50 +00:00
|
|
|
.init();
|
|
|
|
|
2020-10-31 19:53:03 +00:00
|
|
|
Server::bind(("localhost", GEMINI_PORT))
|
2020-11-24 22:28:54 +00:00
|
|
|
.add_route("/", PathBuf::from("public")) // Serve directory listings & file contents
|
|
|
|
.add_route("/about", PathBuf::from("README.md")) // Serve a single file
|
2020-11-20 03:33:44 +00:00
|
|
|
.serve()
|
2020-10-31 19:53:03 +00:00
|
|
|
.await
|
|
|
|
}
|