User login and registration using nodejs and mysql with example:
In this tutorial, I am going to create simple email and password login authentication and register a user using nodejs and mysql. I will save simple password in mysql database but this is not good practice for security reason so in next tutorial, you will know the use of BCrypt module of Node.js to encrypt passwords. This tutorial will explain only how to save a record in mysql table and how to check email exist or not in the table with given password. To handle post parameters of Http request in Node.js, we use Body-Parser module. Step1: Table and directory structure: In first step, create a "users" table in the database by running following command in phpmyadmin or in mysql shell : CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, ...