Skip to main content

file_server

Function file_server 

Source
pub fn file_server(root: String) -> impl Handler
Expand description

Serve files from the filesystem rooted at root. Port of Go’s http.FileServer.

The URL path is joined to root to form the filesystem path. Directory listings are not supported — a 403 is returned for directories. File reads are performed synchronously within the goroutine (no extra goroutine spawn needed since each connection already has its own goroutine).