Closed Harshitk816 closed 6 months ago
-Hi harshit i think you have created the method some where but its empty as of now can you please check the code
While configuring the env file you write the path wrong. It should be path: './.env'
it was a simple fix i forgot to add a callback brackets to the error listening in the index.js:
connectDB() .then(()=>{ app.on("error",(error)=>{ console.log("Error in Database Connection : " + error); }) }
previously it was :
connectDB() .then( app.on("error",(error)=>{ console.log("Error in Database Connection : " + error); ) }
So I am in the video of 'ROUTES AND CONTROLLER WITH DEBUGGING". After the creating my register route, i started the server and got: `Server is running on port 8000 /n Database connected !! DB HOST: ac-fdtffkb-shard-00-02.gcq7rur.mongodb.net Error in DB Connection TypeError: Cannot read properties of undefined (reading 'method') at Function.handle (C:\Users\Harshit\Desktop\Chai Aur Code Backend\chai_aur_backend\node_modules\express\lib\router\index.js:139:34)
at Function.handle (C:\Users\Harshit\Desktop\Chai Aur Code Backend\chai_aur_backend\node_modules\express\lib\application.js:181:10)
at app (C:\Users\Harshit\Desktop\Chai Aur Code Backend\chai_aur_backend\node_modules\express\lib\express.js:39:9) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///C:/Users/Harshit/Desktop/Chai%20Aur%20Code%20Backend/chai_aur_backend/src/index.js:15:1
`
I am unable to identify the problem yet. But it was connecting properly the last time I checked.. This is my index.js
this is my db/index.js