Giter VIP home page Giter VIP logo

oatpp-examples's Issues

in WSL, run get Aborted

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

Add example for Custom Types

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.

How to return a std::vector data back to caller?

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 example has a bug!

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'

Need an example for parsing received JSON body

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.