From 02f20bf0307549cd126b582a2ad1fcf2d0180a58 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sun, 10 Feb 2019 11:18:53 +0100 Subject: [PATCH] Add listen(host, port, callback) --- src/App.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/App.h b/src/App.h index dd7b40c..35a397c 100644 --- a/src/App.h +++ b/src/App.h @@ -268,6 +268,13 @@ public: return std::move(*this); } + /* Host, port, callback */ + TemplatedApp &&listen(std::string host, int port, fu2::unique_function &&handler) { + handler(httpContext->listen(host.c_str(), port, 0)); + return std::move(*this); + } + + /* Port, callback */ TemplatedApp &&listen(int port, fu2::unique_function &&handler) { handler(httpContext->listen(nullptr, port, 0)); return std::move(*this);