Fixing pistache usage so make builds cleanly
This commit is contained in:
@@ -11,7 +11,7 @@ namespace daggy {
|
|||||||
public:
|
public:
|
||||||
Server(Pistache::Address addr)
|
Server(Pistache::Address addr)
|
||||||
: endpoint_(addr)
|
: endpoint_(addr)
|
||||||
, desc("Daggy API", "0.1")
|
, desc_("Daggy API", "0.1")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void init(int threads = 1);
|
void init(int threads = 1);
|
||||||
@@ -23,7 +23,7 @@ namespace daggy {
|
|||||||
|
|
||||||
Pistache::Http::Endpoint endpoint_;
|
Pistache::Http::Endpoint endpoint_;
|
||||||
Pistache::Rest::Description desc_;
|
Pistache::Rest::Description desc_;
|
||||||
Pistache::Http::Router router_;
|
Pistache::Rest::Router router_;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
#include <daggy/Server.hpp>
|
#include <daggy/Server.hpp>
|
||||||
|
|
||||||
|
using namespace Pistache;
|
||||||
|
|
||||||
namespace daggy {
|
namespace daggy {
|
||||||
void Server::init(int threads = 1) {
|
void Server::init(int threads) {
|
||||||
auto opts = Http::Endpoint::options()
|
auto opts = Http::Endpoint::options()
|
||||||
.threads(threads)
|
.threads(threads)
|
||||||
;
|
;
|
||||||
endpoint_->init(opts);
|
endpoint_.init(opts);
|
||||||
createDescription();
|
createDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::start() {
|
void Server::start() {
|
||||||
router.initFromDescription(desc_);
|
router_.initFromDescription(desc_);
|
||||||
|
|
||||||
httpEndpoint->setHandler(router.handler());
|
endpoint_.setHandler(router_.handler());
|
||||||
httpEndpoint->serve();
|
endpoint_.serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::createDescription() {
|
void Server::createDescription() {
|
||||||
@@ -31,11 +33,13 @@ namespace daggy {
|
|||||||
.produces(MIME(Application, Json))
|
.produces(MIME(Application, Json))
|
||||||
.consumes(MIME(Application, Json));
|
.consumes(MIME(Application, Json));
|
||||||
|
|
||||||
|
/*
|
||||||
desc_
|
desc_
|
||||||
.route(desc_.get("/ready"))
|
.route(desc_.get("/ready"))
|
||||||
.bind(&Generic::handleReady)
|
.bind(&Generic::handleReady)
|
||||||
.response(Http::Code::Ok, "Response to the /ready call")
|
.response(Http::Code::Ok, "Response to the /ready call")
|
||||||
.hide();
|
.hide();
|
||||||
|
*/
|
||||||
|
|
||||||
auto versionPath = desc_.path("/v1");
|
auto versionPath = desc_.path("/v1");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user