From c3fbba26786029d067a2e4f39b1300c13815d609 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Fri, 6 Apr 2018 18:40:57 -0400 Subject: [PATCH] Guide: updates to static file handling chapter. --- guide/src/qs_12.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/guide/src/qs_12.md b/guide/src/qs_12.md index 1da5f1ef9..2feb5a1be 100644 --- a/guide/src/qs_12.md +++ b/guide/src/qs_12.md @@ -2,8 +2,8 @@ ## Individual file -It is possible to serve static files with custom path pattern and `NamedFile`. To -match path tail we can use `[.*]` regex. +It is possible to serve static files with a custom path pattern and `NamedFile`. To +match a path tail, we can use a `[.*]` regex. ```rust # extern crate actix_web; @@ -24,9 +24,9 @@ fn main() { ## Directory -To serve files from specific directory and sub-directories `StaticFiles` could be used. -`StaticFiles` must be registered with `App::handler()` method otherwise -it won't be able to serve sub-paths. +To serve files from specific directories and sub-directories, `StaticFiles` can be used. +`StaticFiles` must be registered with an `App::handler()` method, otherwise +it will be unable to serve sub-paths. ```rust # extern crate actix_web; @@ -39,11 +39,11 @@ fn main() { } ``` -First parameter is a base directory. Second parameter is *show_index*, if it is set to *true* -directory listing would be returned for directories, if it is set to *false* -then *404 Not Found* would be returned instead of directory listing. +The first parameter is the base directory. If the second parameter, *show_index*, is set to **true**, +the directory listing will be returned, and if it is set to **false**, +*404 Not Found* will be returned. -Instead of showing files listing for directory, it is possible to redirect to specific -index file. Use +Instead of showing files listing for directory, it is possible to redirect to a specific +index file. Use the [*StaticFiles::index_file()*](../actix_web/s/struct.StaticFiles.html#method.index_file) method to configure this redirect.