From 5e37e383982c3bda0535c61c31e79e3829b0d684 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 29 Nov 2019 23:32:59 -0500 Subject: [PATCH] Updated README --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8242831..ec15513 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,16 @@ svr.listen_after_bind(); ### Static File Server ```cpp -svr.set_base_dir("./www"); +svr.set_base_dir("./www"); // This is same as `svr.set_base_dir("./www", "/")`; +``` + +```cpp +svr.set_base_dir("./www", "/public"); +``` + +```cpp +svr.set_base_dir("./www1", "/public"); // 1st order +svr.set_base_dir("./www2", "/public"); // 2nd order ``` ### Logging @@ -86,7 +95,7 @@ svr.Post("/multipart", [&](const auto& req, auto& res) { ``` -### Stream content with Content provider +### Send content with Content provider ```cpp const uint64_t DATA_CHUNK_SIZE = 4; @@ -104,6 +113,20 @@ svr.Get("/stream", [&](const Request &req, Response &res) { }); ``` +### Receive content with Content receiver + +```cpp +svr.Post("/content_receiver", + [&](const Request &req, Response &res, const ContentReader &content_reader) { + std::string body; + content_reader([&](const char *data, size_t data_length) { + body.append(data, data_length); + return true; + }); + res.set_content(body, "text/plain"); + }); +``` + ### Chunked transfer encoding ```cpp