Express.js-Custom-Error-Middleware
With this error handle architecture, you will have the chance to manage your backend server errors in a central middleware. Any errors received in the application will return the same structure according to the error code and error message entered.