Add logging functionality to already existing REST service.
- Add express
middlewarewhich will log incoming requests to service (at leasturl,query parameters,body) and responsestatus code. - Add express
middlewarewhich will log all unhandlederrorsand return a standard message with HTTP code500(Internal Server Error). - Add listener and logging to
uncaughtException. - Add listener and logging to
unhandledRejection. - Writing to
process.stdouor to a file both can be used for logging. Any third-party logging library can also be used for this purpose.