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
421 B
Rust
Raw Normal View History

2019-06-17 23:35:47 +02:00
mod configuration;
mod configuration_two;
mod directory;
// <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>