-1

First time I am deploying a node.js/express server in production. I am planning to deploy nodemon. Log a number of metrics through node middleware, such as timing, number of requests, what endpoints?

Anything anyone uses for my use case?

reza
  • 5,972
  • 15
  • 84
  • 126
  • 3
    Do not use [nodemon](https://www.npmjs.com/package/nodemon) for production, since _nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected._ For production, take a look at [PM2](http://pm2.keymetrics.io/) and others. – pzaenger Jul 24 '19 at 22:29
  • Software recommendation questions are off-topic for Stackoverflow – Quentin Jul 27 '19 at 22:20

2 Answers2

1

use pm2 instead of nodemon, it stores the logs in a file instead of displaying to window, and you can use pm2 logs to see the logs.

use morgan to log req metrics

Vinil Prabhu
  • 1,279
  • 1
  • 10
  • 22
-1

I recommend pm2 as a deployment manager, it has many features like "cluster mode" and "log manager", you can see more about this on this page: http://pm2.keymetrics.io/docs/usage/log-management/

I also recommend that for projects in the production environment, you only handle the error and alerts logs, because the performans of your application is affected by them. Of course pm2 also has options to handle this, and you can define the events to be in your logs.

please see the advantages that pm2 has.

Gonzalo A.
  • 11
  • 2