1
0
mirror of https://github.com/actix/actix-website synced 2024-11-25 09:12:42 +01:00
actix-website/examples/static-files/src/main.rs

18 lines
433 B
Rust
Raw Normal View History

pub mod configuration;
pub mod configuration_two;
pub mod directory;
2019-06-17 23:35:47 +02:00
// <individual-file>
use actix_files::NamedFile;
use actix_web::{web, App, HttpRequest, Result};
use std::path::PathBuf;
fn index(req: HttpRequest) -> Result<NamedFile> {
let path: PathBuf = req.match_info().query("tail").parse().unwrap();
Ok(NamedFile::open(path)?)
}
fn main() {
App::new().route("/", web::get().to(index));
}
// </individual-file>