Skip to content

Commit 8839c0d

Browse files
committed
Update to the latest oatpp API.
1 parent 552ddbc commit 8839c0d

File tree

6 files changed

+14
-52
lines changed

6 files changed

+14
-52
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ target_include_directories(${project_name}-lib PUBLIC src)
1818

1919
## link libs
2020

21-
find_package(oatpp 1.0.0 REQUIRED)
22-
find_package(oatpp-libressl 1.0.0 REQUIRED)
21+
find_package(oatpp 1.1.0 REQUIRED)
22+
find_package(oatpp-libressl 1.1.0 REQUIRED)
2323

2424
include(FindPkgConfig) # <-- include pkg-config needed by FindLibreSSL.cmake script
2525
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") # <-- use FindLibreSSL.cmake in /cmake folder

src/App.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// main.cpp
3-
// web-starter-project
4-
//
5-
// Created by Leonid on 2/12/18.
6-
// Copyright © 2018 oatpp. All rights reserved.
7-
//
81

92
#include "./controller/MyController.hpp"
103
#include "./AppComponent.hpp"

src/AppComponent.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// AppComponent.hpp
3-
// oatpp-web-starter
4-
//
5-
// Created by Leonid on 3/2/18.
6-
// Copyright © 2018 lganzzzo. All rights reserved.
7-
//
81

92
#ifndef AppComponent_hpp
103
#define AppComponent_hpp

src/client/MyApiClient.hpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// MyApiClient.hpp
3-
// tls-libressl
4-
//
5-
// Created by Leonid on 6/23/18.
6-
// Copyright © 2018 oatpp. All rights reserved.
7-
//
81

92
#ifndef MyApiClient_hpp
103
#define MyApiClient_hpp
@@ -13,16 +6,18 @@
136
#include "oatpp/core/data/mapping/type/Object.hpp"
147
#include "oatpp/core/macro/codegen.hpp"
158

16-
class MyApiClient : public oatpp::web::client::ApiClient {
179
#include OATPP_CODEGEN_BEGIN(ApiClient)
10+
11+
class MyApiClient : public oatpp::web::client::ApiClient {
1812

1913
API_CLIENT_INIT(MyApiClient)
2014

2115
API_CALL("GET", "/get", apiGet)
2216

2317
API_CALL_ASYNC("GET", "/get", apiGetAsync)
24-
25-
#include OATPP_CODEGEN_END(ApiClient)
18+
2619
};
2720

21+
#include OATPP_CODEGEN_END(ApiClient)
22+
2823
#endif /* MyApiClient_hpp */

src/controller/MyController.hpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// MyController.hpp
3-
// web-starter-project
4-
//
5-
// Created by Leonid on 2/12/18.
6-
// Copyright © 2018 oatpp. All rights reserved.
7-
//
81

92
#ifndef MyController_hpp
103
#define MyController_hpp
@@ -17,6 +10,9 @@
1710
#include "oatpp/core/macro/codegen.hpp"
1811
#include "oatpp/core/macro/component.hpp"
1912

13+
14+
#include OATPP_CODEGEN_BEGIN(ApiController) //<--- Begin codegen
15+
2016
/**
2117
* EXAMPLE ApiController
2218
* Basic examples of howto create ENDPOINTs
@@ -42,11 +38,6 @@ class MyController : public oatpp::web::server::api::ApiController {
4238
return std::shared_ptr<MyController>(new MyController(objectMapper));
4339
}
4440

45-
/**
46-
* Begin ENDPOINTs generation ('ApiController' codegen)
47-
*/
48-
#include OATPP_CODEGEN_BEGIN(ApiController)
49-
5041
/**
5142
* Hello World endpoint Coroutine mapped to the "/" (root)
5243
*/
@@ -125,11 +116,8 @@ class MyController : public oatpp::web::server::api::ApiController {
125116

126117
};
127118

128-
/**
129-
* Finish ENDPOINTs generation ('ApiController' codegen)
130-
*/
131-
#include OATPP_CODEGEN_END(ApiController)
132-
133119
};
134120

121+
#include OATPP_CODEGEN_END(ApiController) //<--- End codegen
122+
135123
#endif /* MyController_hpp */

src/dto/MyDTOs.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
//
2-
// UserDto.hpp
3-
// crud
4-
//
5-
// Created by Leonid on 3/13/18.
6-
// Copyright © 2018 oatpp. All rights reserved.
7-
//
81

92
#ifndef MyDTOs_hpp
103
#define MyDTOs_hpp
114

12-
#include "oatpp/core/data/mapping/type/Object.hpp"
135
#include "oatpp/core/macro/codegen.hpp"
6+
#include "oatpp/core/Types.hpp"
147

158
#include OATPP_CODEGEN_BEGIN(DTO)
169

1710
/**
1811
* Data Transfer Object. Object containing fields only.
1912
* Used in API for serialization/deserialization and validation
2013
*/
21-
class HelloDto : public oatpp::data::mapping::type::Object {
14+
class HelloDto : public oatpp::Object {
2215

2316
DTO_INIT(HelloDto, Object)
2417

0 commit comments

Comments
 (0)