From 12439d84d7b98cede4a13da6981b72cb62b57a94 Mon Sep 17 00:00:00 2001 From: lganzzzo Date: Mon, 28 Oct 2019 04:15:26 +0200 Subject: [PATCH] modify readme.md --- README.md | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index eb6e883a..d02f4d59 100644 --- a/README.md +++ b/README.md @@ -17,39 +17,9 @@ effective production level development. It's also light and has small memory foo - Follow us on **Twitter** for latest news. [@oatpp_io](https://twitter.com/oatpp_io) - Join community on **Reddit**. [r/oatpp](https://www.reddit.com/r/oatpp/) -## API - High Level Overview +## High Level Overview -### Object Mapping - -For more info see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/). - -#### Declare DTO - -```cpp -class UserDto : public oatpp::data::mapping::type::Object { - - DTO_INIT(UserDto, Object) - - DTO_FIELD(Int64, id); - DTO_FIELD(String, name); - -}; -``` - -#### Serialize DTO Using ObjectMapper - -```cpp -using namespace oatpp::parser::json::mapping; - -auto user = UserDto::createShared(); -user->id = 1; -user->name = "Ivan"; - -auto objectMapper = ObjectMapper::createShared(); -auto json = objectMapper->writeToString(user); -``` - -### API Controller - Request Mapping +### API Controller And Request Mapping For more info see [Api Controller](https://oatpp.io/docs/components/api-controller/) @@ -148,6 +118,36 @@ ENDPOINT("PUT", "/users/{userId}", putUser, } ``` +### Object Mapping + +For more info see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/). + +#### Declare DTO + +```cpp +class UserDto : public oatpp::data::mapping::type::Object { + + DTO_INIT(UserDto, Object) + + DTO_FIELD(Int64, id); + DTO_FIELD(String, name); + +}; +``` + +#### Serialize DTO Using ObjectMapper + +```cpp +using namespace oatpp::parser::json::mapping; + +auto user = UserDto::createShared(); +user->id = 1; +user->name = "Ivan"; + +auto objectMapper = ObjectMapper::createShared(); +auto json = objectMapper->writeToString(user); +``` + ### Read Next - [Well Structured Project](https://oatpp.io/docs/start/step-by-step/#well-structured-project)