Just released the latest version of my open source project...
-
I'd love to hear any feed back regarding design, style and architecture. You can find the source at http://github.com/corvusoft/restbed. Asynchronous RESTful framework
#include <memory>
#include <cstdlib>
#include <restbed>using namespace std;
using namespace restbed;void get_method_handler( const shared_ptr< Session >& session )
{
const auto request = session->get_request( );size\_t content\_length = 0; request->get\_header( "Content-Length", content\_length ); session->fetch( content\_length, \[ \]( const shared\_ptr< Session >& session, const Bytes& body ) { fprintf( stdout, "%.\*s\\n", ( int ) body.size( ), body.data( ) ); session->close( OK, "Hello, World!", { { "Content-Length", "13" } } ); } );
}
int main( const int, const char** )
{
auto resource = make_shared< Resource >( );
resource->set_path( "/resource" );
resource->set_method_handler( "GET", get_method_handler );auto settings = make\_shared< Settings >( ); settings->set\_port( 1984 ); settings->set\_default\_header( "Connection", "close" ); Service service; service.publish( resource ); service.start( settings ); return EXIT\_SUCCESS;
}
Was told to remove this from the C++ threads. Please let me know if this is still not the right place for this?
-
I'd love to hear any feed back regarding design, style and architecture. You can find the source at http://github.com/corvusoft/restbed. Asynchronous RESTful framework
#include <memory>
#include <cstdlib>
#include <restbed>using namespace std;
using namespace restbed;void get_method_handler( const shared_ptr< Session >& session )
{
const auto request = session->get_request( );size\_t content\_length = 0; request->get\_header( "Content-Length", content\_length ); session->fetch( content\_length, \[ \]( const shared\_ptr< Session >& session, const Bytes& body ) { fprintf( stdout, "%.\*s\\n", ( int ) body.size( ), body.data( ) ); session->close( OK, "Hello, World!", { { "Content-Length", "13" } } ); } );
}
int main( const int, const char** )
{
auto resource = make_shared< Resource >( );
resource->set_path( "/resource" );
resource->set_method_handler( "GET", get_method_handler );auto settings = make\_shared< Settings >( ); settings->set\_port( 1984 ); settings->set\_default\_header( "Connection", "close" ); Service service; service.publish( resource ); service.start( settings ); return EXIT\_SUCCESS;
}
Was told to remove this from the C++ threads. Please let me know if this is still not the right place for this?
-
I'd love to hear any feed back regarding design, style and architecture. You can find the source at http://github.com/corvusoft/restbed. Asynchronous RESTful framework
#include <memory>
#include <cstdlib>
#include <restbed>using namespace std;
using namespace restbed;void get_method_handler( const shared_ptr< Session >& session )
{
const auto request = session->get_request( );size\_t content\_length = 0; request->get\_header( "Content-Length", content\_length ); session->fetch( content\_length, \[ \]( const shared\_ptr< Session >& session, const Bytes& body ) { fprintf( stdout, "%.\*s\\n", ( int ) body.size( ), body.data( ) ); session->close( OK, "Hello, World!", { { "Content-Length", "13" } } ); } );
}
int main( const int, const char** )
{
auto resource = make_shared< Resource >( );
resource->set_path( "/resource" );
resource->set_method_handler( "GET", get_method_handler );auto settings = make\_shared< Settings >( ); settings->set\_port( 1984 ); settings->set\_default\_header( "Connection", "close" ); Service service; service.publish( resource ); service.start( settings ); return EXIT\_SUCCESS;
}
Was told to remove this from the C++ threads. Please let me know if this is still not the right place for this?
What most people here would be interested in, and what would generate the most feedback, is an article/set of articles, going into depth about your code. Show the type of challenges you faced, the decisions you took, why you took them, what you rejected and so on. The forums really aren't the place to try and get the type of feedback you're after.
-
What most people here would be interested in, and what would generate the most feedback, is an article/set of articles, going into depth about your code. Show the type of challenges you faced, the decisions you took, why you took them, what you rejected and so on. The forums really aren't the place to try and get the type of feedback you're after.
-
:thumbsup: