Skip to main content

Posts

Showing posts from February 5, 2023

Create/Launch new Product API +Update an Delete Product by Admin, Get Product Details by customer API Nodejs , MongoDB MERN Stack

 //  Create Required following files mentioned in previous post = https://vasubirla.blogspot.com/2023/02/register-new-user-login-user-delete.html  config.env     Server.js  //app.js  /utilsfolder/errorhander.js /utils/jwtToken.js file 3. /utils/sendEmail.js  file //Create Product Model - and import it in ProductController  //ProductModel.js const mongoose = require ( 'mongoose' ); const ProductSchema = new mongoose . Schema ({     name : {         type : String ,         required :[ true , "please enter produt name" ],         trim : true     },     description : {         type : String ,         required :[ true , "please add product description" ]     },     price : {         type : Number ,         required :[ true , "Product Price is required" ],         maxLength :[ 8 , "price cannot be exceed 8 character" ]     },     ratings : {         type : Number ,         default : 0     },     image : [         {             public_id

Register new User, Login User, Delete user, Update User Profile , Forgot/Reset password, Change Password - Node Js , MERN Stack Post 101

Project Folder Architecture will look like this (Setup your Node JS in folder) ========install required package using command - npm install packegeName  for example      npm install express  npm install jsonwebtoken  npm install bcryptjs  etc. etc. ================================================================== First create a file  config.env  inwhich we will set various variable with info   PORT = 4000 Database_url = "mongodb://localhost:27017/E-com" JWT_SECRET = KILVISHKJDKFJKDFJKDKDFKJDSKFSDFKJ   JWT_EXPIRE = 5d COOKIE_EXPIRE = 5 SMTP_SERVICE = "gmail" SMTP_MAIL = 'vasubirla@gmail.com' SMTP_PASSWORD = 'mtvrqzmxlaroeizh' //create your own app pass from your google security setting, this is wrong pass First create Server -  Server.js  const app = require ( './app' ); const dotenv = require ( 'dotenv' ); const connectDatabase = require ( './config/database' ) //Uncaught Exception Handling process. on (