A bit of clean-ups and license fixes

This commit is contained in:
Alex Hultman
2018-11-22 01:29:28 +01:00
parent 63e483b815
commit a25e2ab397
7 changed files with 120 additions and 65 deletions
+34 -31
View File
@@ -5,10 +5,13 @@
int main(int argc, char **argv) {
// here we have it
struct PerSocketData {
};
uWS::App().get("/hello", [](auto *res, auto *req) {
res->end("Hello HTTP!");
}).ws("/*", {
}).ws<void>("/*", {
/*.open = */[](auto *ws, auto *req) {
},
@@ -33,47 +36,47 @@ int main(int argc, char **argv) {
}
}).run();
return 0;
// return 0;
AsyncFileStreamer *asyncFileStreamer = new AsyncFileStreamer("/home/alexhultman/v0.15/public");
// AsyncFileStreamer *asyncFileStreamer = new AsyncFileStreamer("/home/alexhultman/v0.15/public");
uWS::/*SSL*/App(/*{
.key_file_name = "/home/alexhultman/uWebSockets/misc/ssl/key.pem",
.cert_file_name = "/home/alexhultman/uWebSockets/misc/ssl/cert.pem",
.dh_params_file_name = "/home/alexhultman/dhparams.pem",
.passphrase = "1234"
}*/)/*.get("/*", [](auto *res, auto *req) {
// uWS::/*SSL*/App(/*{
// .key_file_name = "/home/alexhultman/uWebSockets/misc/ssl/key.pem",
// .cert_file_name = "/home/alexhultman/uWebSockets/misc/ssl/cert.pem",
// .dh_params_file_name = "/home/alexhultman/dhparams.pem",
// .passphrase = "1234"
// }*/)/*.get("/*", [](auto *res, auto *req) {
res->end("GET /WILDCARD");
// res->end("GET /WILDCARD");
})*/.get("/:param1/:param2", [](auto *res, auto *req) {
// })*/.get("/:param1/:param2", [](auto *res, auto *req) {
res->write("GET /:param1/:param2 = ");
res->write(req->getParameter(0));
res->write(" and ");
res->end(req->getParameter(1));
// res->write("GET /:param1/:param2 = ");
// res->write(req->getParameter(0));
// res->write(" and ");
// res->end(req->getParameter(1));
}).post("/hello", [asyncFileStreamer](auto *res, auto *req) {
// }).post("/hello", [asyncFileStreamer](auto *res, auto *req) {
// depending on the file type we want to also add mime!
//asyncFileStreamer->streamFile(res, req->getUrl());
// // depending on the file type we want to also add mime!
// //asyncFileStreamer->streamFile(res, req->getUrl());
res->end("POST /hello");
// res->end("POST /hello");
}).get("/hello", [](auto *res, auto *req) {
// }).get("/hello", [](auto *res, auto *req) {
res->end("GET /hello");
// res->end("GET /hello");
}).unhandled([](auto *res, auto *req) {
// }).unhandled([](auto *res, auto *req) {
res->writeStatus("404 Not Found");
res->writeHeader("Content-Type", "text/html; charset=utf-8");
res->end("<h1>404 Not Found</h1><i>µWebSockets v0.15</i>");
// res->writeStatus("404 Not Found");
// res->writeHeader("Content-Type", "text/html; charset=utf-8");
// res->end("<h1>404 Not Found</h1><i>µWebSockets v0.15</i>");
}).listen(3000, [](auto *token) {
if (token) {
std::cout << "Listening on port " << 3000 << std::endl;
}
}).run();
// }).listen(3000, [](auto *token) {
// if (token) {
// std::cout << "Listening on port " << 3000 << std::endl;
// }
// }).run();
}