title: NodeJS & EJS POST
body: <p>I'm using NodeJS/Express and EJS to create a form to an API route. When I try a POST request and call req.body.password &amp; req.body.confirm , I get "undefined". </p>
  
  <p>index.js</p>
  
  <pre><code>import http from 'http';
  import express from 'express';
  import bodyParser from 'body-parser';
  import mongoose from 'mongoose';
  import passport from 'passport';
  const LocalStrategy = require('passport-local').Strategy;
  var flash = require('connect-flash');
  
  import config from './config';
  import routes from './routes';
  
  let app = express();
  app.server = http.createServer(app);
  
  //middleware
  app.use(bodyParser.json({
    limit: config.bodyLimit
  }));
  
  //EJS VIEWS CODE
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  app.use(flash());
  </code></pre>
  
  <p>Part of my Controller w/ imports</p>
  
  <pre><code>import mongoose from 'mongoose';
  import { Router } from 'express';
  import Account from '../model/account';
  import bodyParser from 'body-parser';
  import passport from 'passport';
  import config from '../config';
  import express from 'express'
  var async = require("async");
  var nodemailer = require("nodemailer");
  var crypto = require("crypto");
  
        if(req.body.password === req.body.confirm) {
            account.setPassword(req.body.password, function(err) {
  </code></pre>
  
  <p>EJS</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;form action="http://localhost:3005/v1/account/reset/&lt;%= token %&gt;" method="POST"&gt;
            &lt;legend&gt;Reset Password&lt;/legend&gt;
            &lt;div class="form-group"&gt;
              &lt;input type="password" name="password" value="" placeholder="New password" id="password" autofocus="autofocus" class="form-control"/&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
              &lt;input type="password" name="confirm" value="" placeholder="Confirm password" id="confirm" class="form-control"/&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;Update Password&lt;/button&gt;
            &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>EDIT: Updated my controller w/ imports</p>