Add SSL example

This commit is contained in:
Alex Hultman
2019-11-25 21:24:29 +01:00
parent 960350e274
commit 91a7a44eea
+20
View File
@@ -0,0 +1,20 @@
#include "App.h"
/* Note that uWS::SSLApp({options}) is the same as uWS::App() when compiles without SSL support */
int main() {
/* Overly simple hello world app */
uWS::SSLApp({
.key_file_name = "../misc/key.pem",
.cert_file_name = "../misc/cert.pem",
.passphrase = "1234"
}).get("/*", [](auto *res, auto *req) {
res->end("Hello world!");
}).listen(3000, [](auto *token) {
if (token) {
std::cout << "Listening on port " << 3000 << std::endl;
}
}).run();
std::cout << "Failed to listen on port 3000" << std::endl;
}