Updated README
This commit is contained in:
parent
8801e51138
commit
7c5197c86c
46
README.md
46
README.md
@ -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
|
||||||
@ -72,22 +76,24 @@ 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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user