diff --git a/daggy/include/daggy/Server.hpp b/daggy/include/daggy/Server.hpp index ee3f222..62d8225 100644 --- a/daggy/include/daggy/Server.hpp +++ b/daggy/include/daggy/Server.hpp @@ -11,7 +11,7 @@ namespace daggy { public: Server(Pistache::Address addr) : endpoint_(addr) - , desc("Daggy API", "0.1") + , desc_("Daggy API", "0.1") {} void init(int threads = 1); @@ -23,7 +23,7 @@ namespace daggy { Pistache::Http::Endpoint endpoint_; Pistache::Rest::Description desc_; - Pistache::Http::Router router_; + Pistache::Rest::Router router_; }; } diff --git a/daggy/src/Server.cpp b/daggy/src/Server.cpp index 4e631e4..ac14976 100644 --- a/daggy/src/Server.cpp +++ b/daggy/src/Server.cpp @@ -1,19 +1,21 @@ #include +using namespace Pistache; + namespace daggy { - void Server::init(int threads = 1) { + void Server::init(int threads) { auto opts = Http::Endpoint::options() .threads(threads) ; - endpoint_->init(opts); + endpoint_.init(opts); createDescription(); } void Server::start() { - router.initFromDescription(desc_); + router_.initFromDescription(desc_); - httpEndpoint->setHandler(router.handler()); - httpEndpoint->serve(); + endpoint_.setHandler(router_.handler()); + endpoint_.serve(); } void Server::createDescription() { @@ -31,11 +33,13 @@ namespace daggy { .produces(MIME(Application, Json)) .consumes(MIME(Application, Json)); + /* desc_ .route(desc_.get("/ready")) .bind(&Generic::handleReady) .response(Http::Code::Ok, "Response to the /ready call") .hide(); + */ auto versionPath = desc_.path("/v1");