diff options
| author | Stefan Boberg <[email protected]> | 2021-09-28 23:25:25 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-28 23:25:25 +0200 |
| commit | 777579d545b32498c4b4b4e9c35b3690584fd148 (patch) | |
| tree | ea15a06a6b76e70bc03a0ab7b66aa179a40dd3fa | |
| parent | http: ReasonStringForHttpResultCode returns string_view to avoid strlen (diff) | |
| download | zen-777579d545b32498c4b4b4e9c35b3690584fd148.tar.xz zen-777579d545b32498c4b4b4e9c35b3690584fd148.zip | |
minor edits to uWS testcode
| -rw-r--r-- | zenhttp/httpuws.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/zenhttp/httpuws.cpp b/zenhttp/httpuws.cpp index e062e7747..2a6950532 100644 --- a/zenhttp/httpuws.cpp +++ b/zenhttp/httpuws.cpp @@ -12,6 +12,7 @@ #if ZEN_PLATFORM_WINDOWS # pragma comment(lib, "Iphlpapi.lib") +# pragma comment(lib, "userenv.lib") #endif namespace zen { @@ -43,26 +44,21 @@ HttpUwsServer::Run(bool IsInteractive) if (TestMode == false) { - zen::logging::ConsoleLog().info("Zen Server running (null HTTP). Press ESC or Q to quit"); + zen::logging::ConsoleLog().info("Zen Server running (uWS HTTP). Press ESC or Q to quit"); } ::uWS::App() - .get("/*", + .any("/*", [](uWS::HttpResponse<false>* res, uWS::HttpRequest* req) { - res->end("Hello world!"); + res->onData([=](std::string_view Data, bool fin) { + ZEN_UNUSED(Data); + if (fin) + res->end("Hello world!"); + }); + + res->onAborted([&] {}); ZEN_UNUSED(req); }) - .post("/*", - [](uWS::HttpResponse<false>* res, uWS::HttpRequest* req) { - res->onData([&](std::string_view Data, bool fin) { - ZEN_UNUSED(Data); - if (fin) - res->end("Hello world!"); - }); - - res->onAborted([&] {}); - ZEN_UNUSED(req); - }) .listen(m_BasePort, [](auto* listen_socket) { ZEN_UNUSED(listen_socket); }) .run(); |