aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ssl/example_ssl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ssl/example_ssl.cpp')
-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();
+ */
+}