Skip to content

Commit 7c5197c

Browse files
committed
Updated README
1 parent 8801e51 commit 7c5197c

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,21 @@ svr.listen_after_bind();
5050
### Static File Server
5151

5252
```cpp
53-
auto ret = svr.set_base_dir("./www"); // This is same as `svr.set_base_dir("./www", "/")`;
53+
// Mount / to ./www directory
54+
auto ret = svr.set_mount_point("./www", "/");
5455
if (!ret) {
5556
// The specified base directory doesn't exist...
5657
}
5758

5859
// Mount /public to ./www directory
59-
ret = svr.set_base_dir("./www", "/public");
60+
ret = svr.set_mount_point("./www", "/public");
6061

6162
// Mount /public to ./www1 and ./www2 directories
62-
ret = svr.set_base_dir("./www1", "/public"); // 1st order to search
63-
ret = svr.set_base_dir("./www2", "/public"); // 2nd order to search
63+
ret = svr.set_mount_point("./www1", "/public"); // 1st order to search
64+
ret = svr.set_mount_point("./www2", "/public"); // 2nd order to search
65+
66+
// Remove mount /
67+
ret = svr.remove_mount_point("/");
6468
```
6569

6670
```cpp
@@ -72,22 +76,24 @@ svr.set_file_extension_and_mimetype_mapping("hh", "text/x-h");
7276

7377
The followings are built-in mappings:
7478

75-
| Extension | MIME Type |
76-
| :--------- | :--------------------- |
77-
| .txt | text/plain |
78-
| .html .htm | text/html |
79-
| .css | text/css |
80-
| .jpeg .jpg | image/jpg |
81-
| .png | image/png |
82-
| .gif | image/gif |
83-
| .svg | image/svg+xml |
84-
| .ico | image/x-icon |
85-
| .json | application/json |
86-
| .pdf | application/pdf |
87-
| .js | application/javascript |
88-
| .wasm | application/wasm |
89-
| .xml | application/xml |
90-
| .xhtml | application/xhtml+xml |
79+
| Extension | MIME Type |
80+
| :-------- | :--------------------- |
81+
| txt | text/plain |
82+
| html, htm | text/html |
83+
| css | text/css |
84+
| jpeg, jpg | image/jpg |
85+
| png | image/png |
86+
| gif | image/gif |
87+
| svg | image/svg+xml |
88+
| ico | image/x-icon |
89+
| json | application/json |
90+
| pdf | application/pdf |
91+
| js | application/javascript |
92+
| wasm | application/wasm |
93+
| xml | application/xml |
94+
| xhtml | application/xhtml+xml |
95+
96+
NOTE: These the static file server methods are not thread safe.
9197

9298
### Logging
9399

0 commit comments

Comments
 (0)