title: Post Request is not working, error showing "cannot post /addstudent/add"
body: <p>This is the post request I want to send but it is not working. I tried working with it in Postman as well as using forms but the error says <strong><em>"cannot POST /addstudent/add"</em></strong>. Below is the code. </p>
  
  <p>This is the JScode: I am using express and using it to post it in MongoDB. </p>
  
  <pre><code>app.post('/addstudent/add', function(req, res){
  db.collection('students').insertOne(req.body, function(error, result){
      if(error)
          throw error;
      res.json(result);
      console.log("New student Successfully Added!");
      })
  })
  </code></pre>
  
  <p>This is the HTML code:</p>
  
  <pre><code>&lt;div class="container-fluid"&gt;
      &lt;div class="formdiv"&gt;
          &lt;form action="/addstudent/add" method="POST"&gt; 
              &lt;div class="form-group"&gt;
                  &lt;label for="exampleInputEmail1"&gt;Student Name&lt;/label&gt;
                  &lt;input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter Name" name="Name"&gt;
                  &lt;small id="emailHelp" class="form-text text-muted"&gt;We'll never share your email with anyone else.&lt;/small&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="exampleInputPassword1"&gt;Student Email&lt;/label&gt;
                  &lt;input type="text" class="form-control" id="exampleInputPassword1" placeholder="Email" name="Email"&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="exampleInputPassword1"&gt;Phone Number&lt;/label&gt;
                  &lt;input type="number" class="form-control" id="exampleInputPassword1" placeholder="Phone Number" name="Number"&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="exampleInputPassword1"&gt;Age&lt;/label&gt;
                  &lt;input type="number" class="form-control" id="exampleInputPassword1" placeholder="Age" name="Age"&gt;
              &lt;/div&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the whole JS code: </p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var mongoDB = require('mongodb').MongoClient;
  var hbs = require('hbs');
  
  var app = express();
  app.use(express.static(__dirname +'/public'));
  
  app.use( bodyParser.urlencoded());
  
  var url = 'mongodb://localhost:27017';
  var db;
  
  mongoDB.connect(url, {useUnifiedTopology: true, useNewUrlParser: true }, 
  function(error, client){
      if(error)
          throw error;
      db = client.db('attainu');
  });
  
  app.get('/instructors', function(req, res){
      res.render('instructor.hbs');
  })
  
  app.get('/students', function(req, res){
      res.render('index.hbs');
  })
  
  app.post('/addstudent/add', function(req, res){
      db.collection('students').insertOne(req.body, function(error, result){
          if(error)
              throw error;
          res.json(result);
          console.log("New student Successfully Added!");
      })
  })
  
  app.listen(3000);
  </code></pre>