debug 500 errors in NodeJS,ExpressJS application

In app.js file at end of code write

Then create a new ejs file called error.ejs in /views folder and put following code