3 #include <nghttp2/asio_http2_server.h>
5 using namespace nghttp2::asio_http2
;
6 using namespace nghttp2::asio_http2::server
;
8 int main(int argc
, char* argv
[])
10 boost::system::error_code ec
;
11 boost::asio::ssl::context
tls(boost::asio::ssl::context::sslv23
);
13 tls
.use_private_key_file("smtp.key", boost::asio::ssl::context::pem
);
14 tls
.use_certificate_chain_file("smtp.pem");
16 configure_tls_context_easy(ec
, tls
);
20 server
.handle("/index.html", [](const request
& req
, const response
& res
) {
22 res
.end(file_generator("index.html"));
25 if (server
.listen_and_serve(ec
, tls
, "localhost", "3000")) {
26 std::cerr
<< "error: " << ec
.message() << std::endl
;