aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ssl
diff options
context:
space:
mode:
authorJaeseung Ha <ipknhama@gmail.com>2015-09-20 22:06:00 +0900
committerJaeseung Ha <ipknhama@gmail.com>2015-09-20 22:06:00 +0900
commite4708671bcfd2514edaa1a8e0bd5fa58f00c5fd1 (patch)
treeb47fc83d73c9b6031f75e576e8e633b93eee8901 /examples/ssl
parent5282c9d4aae7ae1450a76fa29ddf837c8eb2f56d (diff)
downloadcrow-e4708671bcfd2514edaa1a8e0bd5fa58f00c5fd1.tar.gz
crow-e4708671bcfd2514edaa1a8e0bd5fa58f00c5fd1.zip
implement HTTPS support
- define CROW_ENABLE_SSL to use - close #88
Diffstat (limited to 'examples/ssl')
-rw-r--r--examples/ssl/example_ssl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/ssl/example_ssl.cpp b/examples/ssl/example_ssl.cpp
new file mode 100644
index 0000000..601aa57
--- /dev/null
+++ b/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();
+ */
+}