forked from loafle/openapi-generator-original
[C++][Pistache] Fix optional error and wrong function signatures (#264)
* Added missing includes for optional * Removed shared pointer from pistache generator * Changed Net namespace to Pistache Namespace * Clean up code and removed unnecessary lines in mustache files * Removed remaining shared pointer syntax * Code review fixes + updated samples * Added const to all model setter functions, and reference to all params in setters that are not primitives * Refactored modelbase * Removed const * Updated samples
This commit is contained in:
@@ -20,24 +20,24 @@ namespace api {
|
||||
using namespace org::openapitools::server::model;
|
||||
|
||||
StoreApi::StoreApi(Pistache::Address addr)
|
||||
: httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(addr))
|
||||
: httpEndpoint(addr)
|
||||
{ };
|
||||
|
||||
void StoreApi::init(size_t thr = 2) {
|
||||
auto opts = Pistache::Http::Endpoint::options()
|
||||
.threads(thr)
|
||||
.flags(Pistache::Tcp::Options::InstallSignalHandler);
|
||||
httpEndpoint->init(opts);
|
||||
httpEndpoint.init(opts);
|
||||
setupRoutes();
|
||||
}
|
||||
|
||||
void StoreApi::start() {
|
||||
httpEndpoint->setHandler(router.handler());
|
||||
httpEndpoint->serve();
|
||||
httpEndpoint.setHandler(router.handler());
|
||||
httpEndpoint.serve();
|
||||
}
|
||||
|
||||
void StoreApi::shutdown() {
|
||||
httpEndpoint->shutdown();
|
||||
httpEndpoint.shutdown();
|
||||
}
|
||||
|
||||
void StoreApi::setupRoutes() {
|
||||
|
||||
Reference in New Issue
Block a user