2

I want to use mongoose for exposing rest apis from inside my aplication. However, I do not see any model of how this can be implemented.

Does anyone knows if it's possible of feasible to do using mongoose?

Can any exemple be provided demonstrating a simple case of it?

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Claudio Junior
  • 295
  • 3
  • 12

1 Answers1

2

I've used mongoose to implement an HTTP interface to a Windows service in C++. It was fairly straightforward to wrap mongoose in a set of C++ classes. It's easy to retrieve request information and generate output streams. I used Boost.IOStreams to implement connection streams so that request handlers could use a std::ostream interface to write results back to the connection.

Use the set_uri_callback() function to define a handler for every possible request.

In each handler get the request type (GET, PUT, POST, etc.) and parameters.

Write the appropriate result back to the connection.

Ferruccio
  • 98,941
  • 38
  • 226
  • 299