Fixing pistache usage so make builds cleanly

This commit is contained in:
Ian Roddis
2021-06-04 11:44:02 -03:00
parent b4deac39d8
commit 936bac8672
2 changed files with 11 additions and 7 deletions

View File

@@ -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_;
};
}

View File

@@ -1,19 +1,21 @@
#include <daggy/Server.hpp>
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");