==============================================================================
| 106 | |
| 107 | //============================================================================== |
| 108 | int main() |
| 109 | { |
| 110 | auto address = "127.0.0.1"; |
| 111 | uint16_t preferredPortNum = 3000; |
| 112 | |
| 113 | bool openedOK = server.open (address, preferredPortNum, 0, |
| 114 | [] |
| 115 | { |
| 116 | // Create a new object for each client.. |
| 117 | return std::make_unique<ExampleClientInstance>(); |
| 118 | }, |
| 119 | [] (const std::string& error) |
| 120 | { |
| 121 | // Handle some kind of server error.. |
| 122 | std::cout << "Error from webserver: " << error << std::endl; |
| 123 | }); |
| 124 | |
| 125 | if (! openedOK) |
| 126 | return 1; |
| 127 | |
| 128 | std::cout << "HTTP server is running!" << std::endl |
| 129 | << std::endl |
| 130 | << "Use a browser to view it at: " << server.getHTTPAddress() << std::endl; |
| 131 | |
| 132 | // While the server is running, this thread no longer needs to be involved. |
| 133 | // For this command-line demo we'll just sleep, but you could also run the |
| 134 | // message loop or get on with other tasks. |
| 135 | |
| 136 | for (;;) |
| 137 | std::this_thread::sleep_for (std::chrono::seconds (1)); |
| 138 | |
| 139 | return 0; |
| 140 | } |
nothing calls this directly
no test coverage detected