Skip to content

Commit

Permalink
Update to the latest oatpp API.
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed Sep 30, 2020
1 parent f9d62c7 commit 401b53b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ add_library(${project_name}-lib

## link libs

find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp 1.2.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
6 changes: 3 additions & 3 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "./controller/MyController.hpp"
#include "./AppComponent.hpp"

#include "oatpp/network/server/Server.hpp"
#include "oatpp/network/Server.hpp"

#include <iostream>

Expand All @@ -25,8 +25,8 @@ void run() {

/* create server */

oatpp::network::server::Server server(components.serverConnectionProvider.getObject(),
components.serverConnectionHandler.getObject());
oatpp::network::Server server(components.serverConnectionProvider.getObject(),
components.serverConnectionHandler.getObject());

OATPP_LOGD("Server", "Running on port %s...", components.serverConnectionProvider.getObject()->getProperty("port").toString()->c_str());

Expand Down
6 changes: 3 additions & 3 deletions src/AppComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "oatpp/web/server/AsyncHttpConnectionHandler.hpp"
#include "oatpp/web/server/HttpRouter.hpp"
#include "oatpp/network/server/SimpleTCPConnectionProvider.hpp"
#include "oatpp/network/tcp/server/ConnectionProvider.hpp"

#include "oatpp/parser/json/mapping/ObjectMapper.hpp"

Expand Down Expand Up @@ -33,7 +33,7 @@ class AppComponent {
*/
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([] {
/* non_blocking connections should be used with AsyncHttpConnectionHandler for AsyncIO */
return oatpp::network::server::SimpleTCPConnectionProvider::createShared(8000);
return oatpp::network::tcp::server::ConnectionProvider::createShared({"localhost", 8000});
}());

/**
Expand All @@ -46,7 +46,7 @@ class AppComponent {
/**
* Create ConnectionHandler component which uses Router component to route requests
*/
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::server::ConnectionHandler>, serverConnectionHandler)([] {
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router); // get Router component
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executor); // get Async executor component
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executor);
Expand Down

0 comments on commit 401b53b

Please sign in to comment.