Fix the router (todo: req->getParameter hook up)

This commit is contained in:
Alex Hultman
2018-10-04 04:05:43 +02:00
parent 7d06bef485
commit be0eb69597
4 changed files with 225 additions and 154 deletions
+10 -4
View File
@@ -12,22 +12,28 @@ int main(int argc, char **argv) {
.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) {
}*/)/*.get("/*", [](auto *res, auto *req) {
res->end("GET /WILDCARD");
}).post("/hello", [asyncFileStreamer](auto *res, auto *req) {
})*/.get("/:param1/:param2", [](auto *res, auto *req/*, auto &params*/) {
// todo: read from params (req->getParameter(0))
res->write("GET /:param1/:param2 = ");
res->end(req->getUrl());
}).post("/hello", [asyncFileStreamer](auto *res, auto *req/*, auto &params*/) {
// depending on the file type we want to also add mime!
//asyncFileStreamer->streamFile(res, req->getUrl());
res->end("POST /hello");
}).get("/hello", [](auto *res, auto *req) {
}).get("/hello", [](auto *res, auto *req/*, auto &params*/) {
res->end("GET /hello");
}).unhandled([](auto *res, auto *req) {
}).unhandled([](auto *res, auto *req/*, auto &params*/) {
res->end("Here's nothing for you to see!");