Skip to content

Commit 5e37e38

Browse files
committed
Updated README
1 parent 295e4d5 commit 5e37e38

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ svr.listen_after_bind();
5050
### Static File Server
5151

5252
```cpp
53-
svr.set_base_dir("./www");
53+
svr.set_base_dir("./www"); // This is same as `svr.set_base_dir("./www", "/")`;
54+
```
55+
56+
```cpp
57+
svr.set_base_dir("./www", "/public");
58+
```
59+
60+
```cpp
61+
svr.set_base_dir("./www1", "/public"); // 1st order
62+
svr.set_base_dir("./www2", "/public"); // 2nd order
5463
```
5564

5665
### Logging
@@ -86,7 +95,7 @@ svr.Post("/multipart", [&](const auto& req, auto& res) {
8695

8796
```
8897

89-
### Stream content with Content provider
98+
### Send content with Content provider
9099

91100
```cpp
92101
const uint64_t DATA_CHUNK_SIZE = 4;
@@ -104,6 +113,20 @@ svr.Get("/stream", [&](const Request &req, Response &res) {
104113
});
105114
```
106115

116+
### Receive content with Content receiver
117+
118+
```cpp
119+
svr.Post("/content_receiver",
120+
[&](const Request &req, Response &res, const ContentReader &content_reader) {
121+
std::string body;
122+
content_reader([&](const char *data, size_t data_length) {
123+
body.append(data, data_length);
124+
return true;
125+
});
126+
res.set_content(body, "text/plain");
127+
});
128+
```
129+
107130
### Chunked transfer encoding
108131
109132
```cpp

0 commit comments

Comments
 (0)