title: POST request to C++ Rest (casablanca) server
body: <p>I am new to full stack development and have few queries, I am working on a project (basically for self learning) in which I want to create a front end using node/express js and at backend want to use a mysql database. Connection between my website and database will be done through a rest server. This rest server will be implemented in Casablanca and will also have logic regarding how to handle database.</p>
  
  <p>So my main concern is how could I handle post request in Casablanca rest server? Motive is to submit form at my site created using node/express js. Forward the value received through form (i.e. through node js rest client) towards Casablanca Rest server which will further update the database.</p>
  
  <p>How could I handle such (post) request in casablanca and fetch values? I have tried few things to make this work and the latest that worked to some extent is mentioned below:</p>
  
  <p>To support HTTP POST request below line is added in the code or listener is registered with POST method:</p>
  
  <pre><code>listener.support(methods::POST, handle_post);
  </code></pre>
  
  <p>And in handle_post method I am trying to extract the json through http_request::extract_json Method, as below:</p>
  
  <pre><code>void handle_post(http_request request)
  {
      try
      {
              json::value v = request.extract_json().get();
              someFunction(v);                              //to iterate over JSON and update database
      }
      catch(http_exception const &amp; e)
      {
              std::wcout &lt;&lt; e.what() &lt;&lt; std::endl;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>After this when I sends a POST request (form Postman plugin of chrome), I am getting 500 internal error, even my someFunction is not getting called. Can someone please provide a clue of what exactly I am doing wrong here?</p>
  
  <p>It could be possible that my whole implementation approach is wrong but it will really be very helpful if someone could provide me some pointers in the right direction.</p>
  
  <p>Thanks in advance :)</p>