From 1e3afe06463f8138d2d9be5dd377537e4ca4919d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 6 Mar 2015 02:23:17 +0900 Subject: [PATCH] Update README for asio server example --- README.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index bad6f088..338fa8aa 100644 --- a/README.rst +++ b/README.rst @@ -1035,7 +1035,7 @@ HTTP/2 server looks like this: .. code-block:: cpp - #include + #include using namespace nghttp2::asio_http2; using namespace nghttp2::asio_http2::server; @@ -1043,11 +1043,12 @@ HTTP/2 server looks like this: int main(int argc, char *argv[]) { http2 server; - server.listen("*", 3000, [](const std::shared_ptr &req, - const std::shared_ptr &res) { - res->write_head(200); - res->end("hello, world"); + server.handle("/", [](const request &req, const response &res) { + res.write_head(200); + res.end("hello, world\n"); }); + + server.listen_and_serve("*", 3000); } For more details, see the documentation of libnghttp2_asio.