title: ExpressJS, NodeJs and Redis Simple Login Error
body: <p>I'm having a problem about checking the username and password in Redis it says username and password is undefined. I hope you can help me to fix this problem in NodeJs/ExpressJs guys.</p>
  
  <p><strong>CODE:</strong></p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>var express = require('express');
  var app = express();
  var redis = require("redis"),
  client = redis.createClient();
  var user, pass;
  
  app.use(express.bodyParser());
  
  client.on("error", function (err) {
  console.log("error event - " + client.host + ":" + client.port + " - " + err);
  });
  
  app.get('/', function (req, res) {
  res.sendfile(__dirname + '/index.html');
  });
  
  app.post('/', function (req, res) {
  console.log("");
  console.log("--------------------");
  console.log(req.body.user.username);
  console.log(req.body.user.password);
  
  console.log("--------EOF---------");
  client.hmget(req.body.user.username + user, req.body.user.pasword + pass,
   redis.print);
  if (req.body.user.username &amp;&amp; req.body.user.password == user &amp;&amp; pass)
  {
      res.write("Successfully logged in!");
  }
  else
  {
      res.write("Username or Password is incorrect");
  }
  console.log("req.body.username: " + req.body.username);
  console.log("req.body.password: " + req.body.password);
  console.log("username: " + user);
  console.log("username: " + pass);
  res.end();
  
  });
  
  app.listen(80)
  </code></pre>
  
  <p>Here's my index.html code.</p>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post" action="/"&gt;
  
  Username: &lt;input type="text" name="user[username]" &gt; &lt;br&gt;
  Password: &lt;input type="text" name="user[password]"&gt; &lt;br&gt;
  
  &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>