Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Just released the latest version of my open source project...

Just released the latest version of my open source project...

Scheduled Pinned Locked Moved Design and Architecture
c++comdesignarchitectureperformance
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Corvusoft
    wrote on last edited by
    #1

    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?

    L P 2 Replies Last reply
    0
    • C Corvusoft

      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?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      No it's still the wrong place. You could try http://www.codeproject.com/Forums/1651/Collaboration-Beta-Testing.aspx[^], although very few people here are interested in this sort of thing.

      1 Reply Last reply
      0
      • C Corvusoft

        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?

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • P Pete OHanlon

          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.

          C Offline
          C Offline
          Corvusoft
          wrote on last edited by
          #4

          Thanks. This sounds like a great idea, will look into it this week.

          P 1 Reply Last reply
          0
          • C Corvusoft

            Thanks. This sounds like a great idea, will look into it this week.

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            :thumbsup:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups