Home » Node.js

How to create login form in Node.js?

In this article, we are going to work further on the last two parts of Log-in and initiate some verification? Here, we are creating a login form that will send data to server for authentication in Node.js.
Submitted by Manu Jemini, on December 04, 2017

Roughly every business website has this technique to identify a particular user by processing his credential. While, the main stream websites or web-apps are using third party signature to reduce the cost significantly, having a hand on this concept still proves to be a gold coin.

Saying so, we must understand its working and then cut the process in part two, learn them and in the end join them.

If you are doing business of any kind you will most likely need to handle your costumers separately. This is easy said than done. This made you keep the track of every user through-out the website. This is very easy if you use sessions.

Now is the last and easy part. We have already discuss much let’s get straight to the code.

Here we have to take two things,

  1. Registered E-mail
  2. Password

Meanwhile, you can also give a link to Signup page and link it both ways which is useful.

Server file

var express = require('express');
var bodyparser = require('body-parse');
var app = express();
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: false }));

res.write('<form action="http://localhost:3000/signin_submit" method="POST">'); 
res.write('<input type="email" name="uemail" placeholder="Enter Email-Address"> <br>'); 
res.write('<input type="password" name="upassword" placeholder="Enter Password"> <br>'); 
res.write('<button type="submit">Create New </button><br>');
res.write('<a href=http://localhost:3000/signup><button type="button">Log In</button></a>');

Output screens

signin form in node.js

Now you are all set, Thank you.

Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com (2015-2018), Some rights reserved.