title: Simple Login Form using node.js and express
body: <p>I started to learn nodejs and installed express with their documentation. Now on the process, i want to create a login form and on clicking log-in i want it to pass to <strong>check</strong> route to check the credentials.</p>
  
  <p>I am not posting the full code here. Just the  part of it.</p>
  
  <pre><code>var routes = require('./routes/index'); //default with express
  var users = require('./routes/users'); //default with express
  var login = require('./routes/login'); //created by me
  var check = require('./routes/check'); //created by me.
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <pre><code>app.use('/', routes);
  app.use('/users', users);
  app.use('/login', login);
  app.use('/check', check);
  </code></pre>
  
  <p>The login route is working fine and i am getting the output. When i  click  login, it enters the route </p>
  
  <pre><code>http://localhost:3000/check
  </code></pre>
  
  <p>and throws 404  not found.</p>
  
  <p>Whereas if i directly enter the url in my browser i am getting the output in the browser.</p>
  
  <p><strong>check.js</strong></p>
  
  <pre><code>router.get('/', function(req, res, next) {
  res.send('respond with a resource');
  });
  </code></pre>
  
  <p><strong>updating check.js</strong></p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  /* GET users listing. */
  router.post('/check', function(req, res, next) {
    res.send('respond with a resource');
  });
  
  module.exports = router;
  </code></pre>
  
  <p><strong>login.jade</strong></p>
  
  <pre><code>extends layout
    block content
      div(class="col-md-4 col-lg-4 col-md-offset-4 col-lg-offset-4")
      h1 User Login
      form(name="login", action="/check", method="post")
        div(class="form-group")
          input(type="text", name="user" class="form-control")
        div(class="form-group")
          input(type="password", name="pass" class="form-control")
        div(class="form-group")
          input(type="submit", value="login" class="btn btn-warning form-control")
  </code></pre>
  
  <p>I am also looking for basic documentation to create a node.js application, that is not complicated as well and easy to understand for a noob.</p>
  
  <p>Update 1: Error while clicking with login button</p>
  
  <pre><code>Error: Not Found
      at app.use.res.render.message (/home/alaksandar/Desktop/Untitled Folder/myapp/app.js:38:13)
      at Layer.handle [as handle_request] (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/layer.js:82:5)
      at trim_prefix (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:302:13)
      at /home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:270:7
      at Function.proto.process_params (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:321:12)
      at next (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:261:10)
      at /home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:603:15
      at next (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:246:14)
      at Function.proto.handle (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:166:3)
      at router (/home/alaksandar/Desktop/Untitled Folder/myapp/node_modules/express/lib/router/index.js:35:12)
  </code></pre>