Struct actix_web::fs::StaticFiles
[−]
[src]
pub struct StaticFiles<S> { /* 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<S: 'static> StaticFiles<S>
[src]
pub fn new<T: Into<PathBuf>>(dir: T, index: bool) -> StaticFiles<S>
[src]
Create new StaticFiles
instance
dir
- base directory
index
- show index for directory
pub fn index_file<T: Into<String>>(self, index: T) -> StaticFiles<S>
[src]
Set index file
Redirects to specific index file for directory "/" instead of showing files listing.
pub fn default_handler<H: Handler<S>>(self, handler: H) -> StaticFiles<S>
[src]
Sets default resource which is used when no matched file could be found.