title: nodejs unhandled promise rejection when app.post
body: <p>When my angular frontend sends <code>post</code> request </p>
  
  <pre><code>order(market: string, price: string, side: string, size: string): Observable&lt;any&gt; {
          var payload = { market: market, order: { price: price, side: side, size: size } };
          return this.http.post&lt;any&gt;('http://localhost:3000' + "/orders", payload))
              .pipe(
                  tap((res: any) =&gt; {
                     console.log(res);
                  }),
                  retry(3), // retry a failed request up to 3 times
                  catchError(this.handleError) // then handle the error
              );
      }
  </code></pre>
  
  <p>my nodejs server receives it </p>
  
  <pre><code>app.post('/orders', (req, res) =&gt; {
      console.log(req.body) 
      // more code
  
      setTimeout(function () {
          axios.post('https://test.com/api/orders', payload, { headers: headers })
              .then((response) =&gt; { 
                  if (response.status === 201) {
                      res.sendStatus(201);                    
                  } else {
                      res.sendStatus(400);  
                  }           
              })
      }, 500);    
  });
  </code></pre>
  
  <p>I added <code>setTimeout</code> because without it I'm getting <code>Error: Request failed with status code 400</code>.</p>
  
  <p>As a result, I can post an order to <code>test.com/api/orders</code>, but getting promise rejection.</p>
  
  <blockquote>
    <p>(node:9220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag <code>--unhandled-rejections=strict</code> (see <a href="https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode" rel="nofollow noreferrer">https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode</a>). (rejection id: 2)
    (node:9220) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.</p>
  </blockquote>
  
  <p>Any enhancement i can make here?</p>