DEV Community

Cover image for node js express error (node:16508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property(solution)
Osman Forhad
Osman Forhad

Posted on • Updated on

node js express error (node:16508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property(solution)

trying to working with insert data into MongoDB and it was tasted by the POST Man testing tool but it shows me the below error:
(node:16508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property
at this time I was not sure why this has happened then I was trying to search to find out it after a couple of time I find what was my mistake. the mistake I did which is I did not import middleware in my index file. so to solve this I goto this index.js file and import middleware there which is like below:
Alt Text
after importing this now everything is okay.
now my postman is like below:
Alt Text
.
that's it.
.
Happy Coding.
osman forhad
Mobile & Web Application Developerđź’»

Top comments (0)