example_ssl.cpp 518 B

123456789101112131415161718192021222324252627
  1. #define CROW_ENABLE_SSL
  2. #include "crow.h"
  3. int main()
  4. {
  5. crow::SimpleApp app;
  6. CROW_ROUTE(app, "/")
  7. ([]() {
  8. return "Hello world!";
  9. });
  10. app.port(18080).ssl_file("test.crt", "test.key").run();
  11. // Use .pem file
  12. //app.port(18080).ssl_file("test.pem").run();
  13. // Use custom context; see boost::asio::ssl::context
  14. /*
  15. * crow::ssl_context_t ctx;
  16. * ctx.set_verify_mode(...)
  17. *
  18. * ... configuring ctx
  19. *
  20. * app.port(18080).ssl(ctx).run();
  21. */
  22. }