oatpp / oatpp-examples Goto Github PK
View Code? Open in Web Editor NEWList of example projects of how to use oat++ framework
Home Page: https://oatpp.io/
License: Apache License 2.0
List of example projects of how to use oat++ framework
Home Page: https://oatpp.io/
License: Apache License 2.0
terminate called after throwing an instance of 'std::runtime_error'
what(): Can't bind to address
Aborted(core dumped)
not add the component for server, it's ok, but add the compont on the step-by-step, get the wrong
Can you provide a complete example of how to set up an endpoint that uses custom types?
I was trying the sample code in the documentation, but it was not clear to me where in the project the code to set up the object mapper should go, or how I can have a custom type struct that contains std::string members .
Would really love to get this part working, as it otherwise seems like a promising framework.
I have set a DTO like:
DTO_FIELD(Vector, MatrixData, "MatrixData");
In application, how can I set a std::vector value to the MatrixData? The example seems uses orm, but I have no database and I think there should be some way to use C++ data straightly.
The post param as:
{"id": 1,"first-name": "xxxxx","last-name": "xxxxx","friends": ["xxxxx"]}
but response:
server=oatpp/0.18.9
code=400
description=Bad Request
message=Missing valid body parameter 'userDto'
Hi Leonid,
I've a requirement to parse received JSON body.
My DTO is as below,
class DataDto : public oatpp::data::mapping::type::Object {
DTO_INIT(DataDto, Object /* Extends */)
DTO_FIELD(Float32, temperature); // temperature code field
DTO_FIELD(Int64, timestamp); // timestamp field
};
My controller is as below,
ENDPOINT("POST", "{path-param}/temperature", getTemperature,
REQUEST(std::shared_ptr<IncomingRequest>, request), // Map request object to endpoint method
PATH(String, pathParam, "path-param"),
BODY_DTO(DataDto::ObjectWrapper, DataDto)) {
OATPP_LOGI("App", "Received call-back for temperature");
/* return result */
return createResponse(Status::CODE_200, "path-param=" + pathParam);
}
Although I see that the controller gets called properly and I'm able to send response with CODE_200, I did not find example to parse the body and get the output.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.