Show error message on 500
duard opened this issue · comments
This is exactly how it should work. Brother you should not tell the public facing API that your database does not exist. It is a security risk.
This message should be only displayed to the developers which you can get from the logs or the console. Thus, every time an internal error occurs the API sends a 500, Server Error. You will have to check your logs and fix the problem.
@mesaugat thanks for repply ! Its only an example of type of error I want to show ... of course I will not show it in production ;-) and I will show it only in development mode !
This is the line returning 500 error response. You need to change a few lines in this file to show that error message in the response. https://github.com/mesaugat/express-api-es6-starter/blob/master/src/utils/buildError.js#L34-L38