mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-23 16:00:07 +00:00
Update README for asio server example
This commit is contained in:
parent
38788d707b
commit
1e3afe0646
11
README.rst
11
README.rst
@ -1035,7 +1035,7 @@ HTTP/2 server looks like this:
|
|||||||
|
|
||||||
.. code-block:: cpp
|
.. code-block:: cpp
|
||||||
|
|
||||||
#include <nghttp2/asio_http2.h>
|
#include <nghttp2/asio_http2_server.h>
|
||||||
|
|
||||||
using namespace nghttp2::asio_http2;
|
using namespace nghttp2::asio_http2;
|
||||||
using namespace nghttp2::asio_http2::server;
|
using namespace nghttp2::asio_http2::server;
|
||||||
@ -1043,11 +1043,12 @@ HTTP/2 server looks like this:
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
http2 server;
|
http2 server;
|
||||||
|
|
||||||
server.listen("*", 3000, [](const std::shared_ptr<request> &req,
|
server.handle("/", [](const request &req, const response &res) {
|
||||||
const std::shared_ptr<response> &res) {
|
res.write_head(200);
|
||||||
res->write_head(200);
|
res.end("hello, world\n");
|
||||||
res->end("hello, world");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.listen_and_serve("*", 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
For more details, see the documentation of libnghttp2_asio.
|
For more details, see the documentation of libnghttp2_asio.
|
||||||
|
Loading…
Reference in New Issue
Block a user