Posts

THUNDERBOLT LAG (CHROME BROOWSER TOO)

 WHEN TRYING TO RUN EVEN A GET REQUEST LIKE THE HOME ROUTE THUNDERBOLT AND BROWSER DOESNOT RESPOND. WHEN CHECKED FOR MISTAKES WE DIDN'T USE THE COOKIE PARSER CORRECTLY. THAT'S WHY THE SERVER COULDNOT RESPOND. WE USED THE COOKIE PARSER LIKE THIS app . use ( cookieParser ); BUT WE NEED TO USE IT LIKE THIS app . use ( cookieParser ());

ERROR WHILE DECONSTRUCTING

Image
  THIS ERROR OCCURED BECAUSE , WE DIDN'T USE app . use ( express . json ()); app . use ( express . urlencoded ({ extended : true })); AFTER USING

ERROR IN MODEL

Image
  const Model = mongoose .M odel ; THIS IS WRONG  const mongoose = require ( "mongoose" ); const Schema = mongoose . Schema ; const Model = mongoose . model ; const userSchema = new Schema ({   name : String ,   email : {     type : String ,       },   password : {     type : String ,       }, }); const user = new Model ( "user" , userSchema ); module . exports = user ;

dotenv should be required

Image
  const express = require ( "express" ); const mongoose = require ( "mongoose" ); const app = express (); const db_URL = process . env . MONGO_URL ; app . get ( "/" , ( req , res ) => {   res . send ( "server working.." ); }); app . listen ( 8080 , () => {   console . log ( "listening to port 8080" );   mongoose . connect ( db_URL ). then (() => {     console . log ( "DB connected" );   }); }); MISTAKE : dotenv WAS NOT REQUIRED require ( "dotenv" ). config (); const express = require ( "express" ); const mongoose = require ( "mongoose" ); const app = express (); const db_URL = process . env . MONGO_URL ; app . get ( "/" , ( req , res ) => {   res . send ( "server working.." ); }); app . listen ( 8080 , () => {   console . log ( "listening to port 8080" );   mongoose . connect ( db_URL ). then (() => {     console . log (...