Skip to content

Instantly share code, notes, and snippets.

@pxjohnny

pxjohnny/main.rs Secret

Last active January 21, 2021 12:44
#[get("/<path..>")]
async fn static_files(path: PathBuf) -> Result<NamedFile, NotFound<String>> {
let path = PathBuf::from("site").join(path);
NamedFile::open(path).await.map_err(|e| NotFound(e.to_string()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment