title: Handling post request for 2 forms in one page using express
body: <p>I have two forms, newsletter signup form and contact form in one page. I want to make post request for both using node and express. How can I do it?</p>
  <p>Here's the html code for the forums:</p>
  <pre><code>&lt;!-- Newsletter signup Section --&gt;
  
          &lt;section class=&quot;newsletter-section&quot;&gt;
  
              &lt;form action=&quot;/&quot; method=&quot;POST&quot;&gt;
                  &lt;span class=&quot;newsletter-heading u-text-align-centre u-margin-bottom-medium&quot;&gt;
                      Subscribe to our monthly newsletter!
                  &lt;/span&gt;
                  &lt;div class=&quot;row u-text-align-centre&quot;&gt;
                      &lt;input type=&quot;text&quot; name=&quot;email-address&quot; class=&quot;newsletter-input&quot;&gt;
                      &lt;a href=&quot;#&quot; class=&quot;btn-full btn-round newsletter-btn&quot;&gt;Sign Me Up!&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/section&gt;
  
  
          &lt;!--contact section--&gt;
          &lt;section class=&quot;contact-section&quot;&gt;
  
              &lt;div class=&quot;contact-container&quot;&gt;
  
                  &lt;h2&gt;Contact Us&lt;/h2&gt;
  
                  &lt;div class=&quot;container&quot;&gt;
  
                      &lt;div class=&quot;customer-info&quot;&gt;
  
                          &lt;form class=&quot;contact-form&quot; action=&quot;/&quot; method=&quot;POST&quot;&gt;
  
                              &lt;div class=&quot;name&quot;&gt;
                                  &lt;div class=&quot;first-name&quot;&gt;
                                      &lt;label for=&quot;first-name&quot;&gt;First Name&lt;/label&gt;
                                      &lt;input type=&quot;text&quot; id=&quot;name&quot; placeholder=&quot;First Name&quot; /&gt;
                                  &lt;/div&gt;
  
                                  &lt;div class=&quot;last-name&quot;&gt;
                                      &lt;label for=&quot;last-name&quot;&gt;Last Name&lt;/label&gt;
                                      &lt;input type=&quot;text&quot; id=&quot;name&quot; placeholder=&quot;Last Name&quot; /&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;div class=&quot;contact-info&quot;&gt;
                                  &lt;div class=&quot;email&quot;&gt;
                                      &lt;label for=&quot;email&quot;&gt;Email&lt;/label&gt;
                                      &lt;input type=&quot;email&quot; id=&quot;email&quot; placeholder=&quot;email&quot; /&gt;
                                  &lt;/div&gt;
  
                                  &lt;div class=&quot;tel&quot;&gt;
                                      &lt;label for=&quot;tel&quot;&gt;Tel&lt;/label&gt;
                                      &lt;input type=&quot;tel&quot; id=&quot;tel&quot; placeholder=&quot;tel&quot; /&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;div class=&quot;reason&quot;&gt;
                                  &lt;label for=&quot;reason&quot;&gt;How may we help you?&lt;/label&gt;
                                  &lt;select name=&quot;reason&quot; id=&quot;reason&quot;&gt;
                                      &lt;option value=&quot;&quot;&gt;Select an option&lt;/option&gt;
                                      &lt;option value=&quot;Customer-service&quot;&gt;Customer Service&lt;/option&gt;
                                      &lt;option value=&quot;book-event&quot;&gt;Book for an event&lt;/option&gt;
                                      &lt;option value=&quot;place-order&quot;&gt;Place Order&lt;/option&gt;
                                      &lt;option value=&quot;inquiries&quot;&gt;Inqiries&lt;/option&gt;
                                      &lt;option value=&quot;####&quot;&gt;Other&lt;/option&gt;
                                  &lt;/select&gt;
                              &lt;/div&gt;
  
                              &lt;div class=&quot;short-message&quot;&gt;
                                  &lt;textarea id=&quot;message&quot; rows=&quot;10&quot; placeholder=&quot;Type a short message here&quot;&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
  
                              &lt;div class=&quot;save-info&quot;&gt;
                                  &lt;span&gt;Save my info for next time&lt;/span&gt;
                                  &lt;input type=&quot;checkbox&quot; class=&quot;final-input&quot; /&gt;
                              &lt;/div&gt;
  
                              &lt;div class=&quot;submit&quot;&gt;
                                  &lt;button name=&quot;submit&quot; class=&quot;btn-round&quot;&gt;Send&lt;/button&gt;
                              &lt;/div&gt;
  
                          &lt;/form&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/section&gt;
  </code></pre>
  <p>And this is the code for the node.js:</p>
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const ejs = require('ejs');
  const _ = require('lodash');
  
  const app = express();
  
  app.set('view engine', 'ejs');
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(express.static(&quot;public&quot;));
  
  app.get('/', function (req, res) {
       res.render('home', { homeContent: homeStartingContent, posts: posts });
  });
  
  </code></pre>
  <p>That was all of the code. Now I want to add the post request for each of the forms sepeartely.</p>