create database test_db
use test_db;
CREATE TABLE `registration` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`login_mode` varchar(255) NOT NULL DEFAULT '',
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`access_token` text NOT NULL,
`Mobile_number` varchar(255) DEFAULT NULL,
`gender` varchar(255) DEFAULT NULL,
`age` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`profile_image` varchar(255) DEFAULT 'null',
`created_datetime` datetime NOT NULL,
`last_login` datetime NOT NULL,
`otp` int(11) DEFAULT '0',
`otp_msg` varchar(100) DEFAULT NULL,
PRIMARY KEY (`email`),
KEY `id` (`id`)
) ;
go to middleware folder and open dbCon file and pass username host password and database name
yarn install or npm install
node app.js or nodemon app.js
Nodejs Login and registration API
user profile image upload on this folder
auth.js => authontication by using json webtoken on
dbCon => mysql database connection
user.js => router where user login and registration query written
{ "email":" ", "password":" ", "username":" ", "mob_no":" ", "gender":" ", "city":" ", "country":" ", "age":" ", "user_image":"" }
{ "email":" ", "password":" " }
after login user get json web token if email and password is correct
for user details pass json web token "headers":{ "authorization":"auth token"}
For frontend react redux UI download https://github.com/akash22396/reactLogin project