diff options
| author | Mistivia <i@mistivia.com> | 2025-01-15 19:12:12 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-01-15 19:12:46 +0800 |
| commit | 4da382953c830a61ae24ccbe95c4241db8788269 (patch) | |
| tree | 31f6d184273274e2660516d1ac1146b5661f20b6 /lib/crow/examples/ssl/example_ssl.cpp | |
restore
Diffstat (limited to 'lib/crow/examples/ssl/example_ssl.cpp')
| -rw-r--r-- | lib/crow/examples/ssl/example_ssl.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/crow/examples/ssl/example_ssl.cpp b/lib/crow/examples/ssl/example_ssl.cpp new file mode 100644 index 0000000..601aa57 --- /dev/null +++ b/lib/crow/examples/ssl/example_ssl.cpp @@ -0,0 +1,27 @@ +#define CROW_ENABLE_SSL +#include "crow.h" + +int main() +{ + crow::SimpleApp app; + + CROW_ROUTE(app, "/") + ([]() { + return "Hello world!"; + }); + + app.port(18080).ssl_file("test.crt", "test.key").run(); + + // Use .pem file + //app.port(18080).ssl_file("test.pem").run(); + + // Use custom context; see boost::asio::ssl::context + /* + * crow::ssl_context_t ctx; + * ctx.set_verify_mode(...) + * + * ... configuring ctx + * + * app.port(18080).ssl(ctx).run(); + */ +} |
