1
0
mirror of synced 2025-04-21 22:25:55 +03:00

Updated README

This commit is contained in:
yhirose 2020-01-31 20:40:33 -05:00
parent 8801e51138
commit 7c5197c86c

View File

@ -50,17 +50,21 @@ svr.listen_after_bind();
### Static File Server ### Static File Server
```cpp ```cpp
auto ret = svr.set_base_dir("./www"); // This is same as `svr.set_base_dir("./www", "/")`; // Mount / to ./www directory
auto ret = svr.set_mount_point("./www", "/");
if (!ret) { if (!ret) {
// The specified base directory doesn't exist... // The specified base directory doesn't exist...
} }
// Mount /public to ./www directory // Mount /public to ./www directory
ret = svr.set_base_dir("./www", "/public"); ret = svr.set_mount_point("./www", "/public");
// Mount /public to ./www1 and ./www2 directories // Mount /public to ./www1 and ./www2 directories
ret = svr.set_base_dir("./www1", "/public"); // 1st order to search ret = svr.set_mount_point("./www1", "/public"); // 1st order to search
ret = svr.set_base_dir("./www2", "/public"); // 2nd order to search ret = svr.set_mount_point("./www2", "/public"); // 2nd order to search
// Remove mount /
ret = svr.remove_mount_point("/");
``` ```
```cpp ```cpp
@ -73,21 +77,23 @@ svr.set_file_extension_and_mimetype_mapping("hh", "text/x-h");
The followings are built-in mappings: The followings are built-in mappings:
| Extension | MIME Type | | Extension | MIME Type |
| :--------- | :--------------------- | | :-------- | :--------------------- |
| .txt | text/plain | | txt | text/plain |
| .html .htm | text/html | | html, htm | text/html |
| .css | text/css | | css | text/css |
| .jpeg .jpg | image/jpg | | jpeg, jpg | image/jpg |
| .png | image/png | | png | image/png |
| .gif | image/gif | | gif | image/gif |
| .svg | image/svg+xml | | svg | image/svg+xml |
| .ico | image/x-icon | | ico | image/x-icon |
| .json | application/json | | json | application/json |
| .pdf | application/pdf | | pdf | application/pdf |
| .js | application/javascript | | js | application/javascript |
| .wasm | application/wasm | | wasm | application/wasm |
| .xml | application/xml | | xml | application/xml |
| .xhtml | application/xhtml+xml | | xhtml | application/xhtml+xml |
NOTE: These the static file server methods are not thread safe.
### Logging ### Logging