Skip to main content

Posts

Showing posts from January 8, 2023

Forgot Password API - with Postman Testing node js , express js , MySQL,

 // Hello coders , follow previous post for product architecture -   Today we are going to see how to reset password & update it in mysql database-      ==============  follow previous post for helper files & folders ====  //================= app.js  ==============   //to Generate OTP -  var otp; function setValue()       {     otp =   Math.random();       otp = otp * 1000000;         otp = parseInt(otp);           console.log(otp);         } function getValue() {     console.log(otp); // yup, it's "test" } //======= Forgot Button on Login Page- will redirect to /forgotPassord app.post("/resetpasswordOTP",(req,res)=>{     //res.redirect("/forgotpassword");                 res.status(200).json({success:"Enter verified email"});  }) //============== Forgot Password Button End ======================== //=============== Page to send OTP method- post, action-"/resetpassword" ============ app.post("/forgotpassword",(r

SignUP & Login API using MYSQL Database - NodeJS, Express Js, MYsql

//  create a new folder and setup Node JS in it using command npm init    // install required node dependencies (express, bcyrptjs, body-parser, nodemon) using command 'npm install express' & same for other modules  Project Architecture - refer Image - and create your Dirs & files inside  // edit package.json files - put your server file name (here app.js) in the main section - (refer above picture)  as well in scripts  put "start":"nodemon" inplace of dev - so that you will have to run command once npm start -  each time you will edit app.js file it will be auto refreshed  on cmd or terminal -  open your folder in cmd and use npm start after making app.js -  //app.js file -  ================== app.js Start =======================================  const express = require('express'); const connection = require('./connection.js'); const bodyParser = require('body-parser'); const { signupValidation } = require('./validation&#