Updated the simple example
This commit is contained in:
parent
e42a358da8
commit
85b4abbf16
@ -15,11 +15,13 @@ Simple examples
|
|||||||
#### Server
|
#### Server
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
#include "path/to/httplib.h"
|
||||||
|
|
||||||
// HTTP
|
// HTTP
|
||||||
httplib::Server svr;
|
httplib::Server svr;
|
||||||
|
|
||||||
// HTTPS
|
// HTTPS
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
httplib::SSLServer svr;
|
httplib::SSLServer svr;
|
||||||
|
|
||||||
svr.Get("/hi", [](const httplib::Request &, httplib::Response &res) {
|
svr.Get("/hi", [](const httplib::Request &, httplib::Response &res) {
|
||||||
@ -32,11 +34,13 @@ svr.listen("0.0.0.0", 8080);
|
|||||||
#### Client
|
#### Client
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
#include "path/to/httplib.h"
|
||||||
|
|
||||||
// HTTP
|
// HTTP
|
||||||
httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co");
|
httplib::Client cli("http://cpp-httplib-server.yhirose.repl.co");
|
||||||
|
|
||||||
// HTTPS
|
// HTTPS
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
httplib::Client cli("https://cpp-httplib-server.yhirose.repl.co");
|
httplib::Client cli("https://cpp-httplib-server.yhirose.repl.co");
|
||||||
|
|
||||||
auto res = cli.Get("/hi");
|
auto res = cli.Get("/hi");
|
||||||
@ -711,6 +715,7 @@ NOTE: cpp-httplib currently supports only version 1.1.1.
|
|||||||
|
|
||||||
```c++
|
```c++
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
#include "path/to/httplib.h"
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
httplib::SSLServer svr("./cert.pem", "./key.pem");
|
httplib::SSLServer svr("./cert.pem", "./key.pem");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user