aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ssl/example_ssl.cpp
blob: 601aa574d43421b031f9ec5d3677695ce5c852d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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();
     */
}