Struct actix_web::fs::StaticFiles
[−]
[src]
pub struct StaticFiles { /* fields omitted */ }
Static files handling
StaticFile
handler must be registered with Application::handler()
method,
because StaticFile
handler requires access sub-path information.
use actix_web::{fs, Application}; fn main() { let app = Application::new() .handler("/static", fs::StaticFiles::new(".", true)) .finish(); }
Methods
impl StaticFiles
[src]
pub fn new<T: Into<PathBuf>>(dir: T, index: bool) -> StaticFiles
[src]
Create new StaticFiles
instance
dir
- base directory
index
- show index for directory
pub fn index_file<T: Into<String>>(self, index: T) -> StaticFiles
[src]
Set index file
Redirects to specific index file for directory "/" instead of showing files listing.
Trait Implementations
impl<S> Handler<S> for StaticFiles
[src]
type Result = Result<FilesystemElement, Error>
The type of value that handler will return.
fn handle(&mut self, req: HttpRequest<S>) -> Self::Result
[src]
Handle request