# Oat++
**Attention**
- Version `1.2.0` is now merged to Master and soon will receive a release tag. Get ready to migrate - see the [changelog](changelog/1.2.0.md) for details.
- To checkout the latest `1.1.0` code use this commit - [e577681355ca652f317867c609e07cefabc37c0a](https://github.com/oatpp/oatpp/tree/e577681355ca652f317867c609e07cefabc37c0a)
---
Oat++ is a modern Web Framework for C++.
It's fully loaded and contains all necessary components for effective production level development.
It's also light and has a small memory footprint.
**Start**
- [Get Started](https://oatpp.io/docs/start/)
- [Build For Unix/Linux](https://oatpp.io/docs/installation/unix-linux/)
- [Build For Windows](https://oatpp.io/docs/installation/windows/)
- [Examples](#examples)
**About**
- [Website](https://oatpp.io/)
- [Supported Platforms](https://oatpp.io/supported-platforms/)
- Latest Benchmarks: [5 Million WebSockets](https://oatpp.io/benchmark/websocket/5-million/)
- [Contributing to Oat++](CONTRIBUTING.md)
**Join Our Community**
- Chat on **Gitter**. [Oat++ framework/Lobby](https://gitter.im/oatpp-framework/Lobby)
- 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/)
## High Level Overview
- [API Controller And Request Mapping](#api-controller-and-request-mapping)
* [Declare Endpoint](#declare-endpoint)
* [Add CORS for Endpoint](#add-cors-for-endpoint)
* [Endpoint with Authorization](#endpoint-with-authorization)
- [Swagger-UI Annotations](#swagger-ui-annotations)
* [Additional Endpoint Info](#additional-endpoint-info)
- [API Client - Retrofit / Feign Like Client](#api-client---retrofit--feign-like-client)
* [Declare Client](#declare-client)
* [Using API Client](#using-api-client)
- [Object Mapping](#object-mapping)
* [Declare DTO](#declare-dto)
* [Serialize DTO Using ObjectMapper](#serialize-dto-using-objectmapper)
### API Controller And Request Mapping
For more info see [Api Controller](https://oatpp.io/docs/components/api-controller/)
#### Declare Endpoint
```cpp
ENDPOINT("PUT", "/users/{userId}", putUser,
PATH(Int64, userId),
BODY_DTO(Object, userDto))
{
userDto->id = userId;
return createDtoResponse(Status::CODE_200, m_database->updateUser(userDto));
}
```
#### Add CORS for Endpoint
For more info see [Api Controller / CORS](https://oatpp.io/docs/components/api-controller/#cors)
```cpp
ADD_CORS(putUser)
ENDPOINT("PUT", "/users/{userId}", putUser,
PATH(Int64, userId),
BODY_DTO(Object, userDto))
{
userDto->id = userId;
return createDtoResponse(Status::CODE_200, m_database->updateUser(userDto));
}
```
#### Endpoint with Authorization
For more info see [Api Controller / Authorization](https://oatpp.io/docs/components/api-controller/#authorization-basic)
```cpp
using namespace oatpp::web::server::handler;
ENDPOINT("PUT", "/users/{userId}", putUser,
AUTHORIZATION(std::shared_ptr, authObject),
PATH(Int64, userId),
BODY_DTO(Object, userDto))
{
OATPP_ASSERT_HTTP(authObject->userId == "Ivan" && authObject->password == "admin", Status::CODE_401, "Unauthorized");
userDto->id = userId;
return createDtoResponse(Status::CODE_200, m_database->updateUser(userDto));
}
```
### Swagger-UI Annotations
For more info see [Endpoint Annotation And API Documentation](https://oatpp.io/docs/components/api-controller/#endpoint-annotation-and-api-documentation)
#### Additional Endpoint Info
```cpp
ENDPOINT_INFO(putUser) {
// general
info->summary = "Update User by userId";
info->addConsumes