Add listen(host, port, callback)

This commit is contained in:
Alex Hultman
2019-02-10 11:18:53 +01:00
parent 399318f866
commit 02f20bf030
+7
View File
@@ -268,6 +268,13 @@ public:
return std::move(*this);
}
/* Host, port, callback */
TemplatedApp &&listen(std::string host, int port, fu2::unique_function<void(us_listen_socket *)> &&handler) {
handler(httpContext->listen(host.c_str(), port, 0));
return std::move(*this);
}
/* Port, callback */
TemplatedApp &&listen(int port, fu2::unique_function<void(us_listen_socket *)> &&handler) {
handler(httpContext->listen(nullptr, port, 0));
return std::move(*this);