In this lesson, you will learn how to install the Formidable nodejs-dashboard. You will learn what each section of the dashboard is used for and see a sample application in action.
On my screen you can see a really simple express application that whenever you hit the root endpoint it uses the faker library to return a random word. Let's take a look real quick and see how it works.
On the left-hand pane I have the node application running. On the right-hand pane I can do a curl localhost on port 3000 and it returns a random word. Let's install NodeJs-dashboard and see how it looks with that.
I'll install NodeJs-dashboard using the npm install command, and save it as a development dependency, because typically you're not going to have an interactive console to log into your production servers.
I'm going to create a command called dev that we'll use to run this. I'll set my environment equal to development, pass in the NodeJs-dashboard command, followed by the command to start my node application.
I also need to require the NodeJs-dashboard package. I'll do that in the entry point to my application which is the bin/www file. We're now ready to start, so I'll switch back over to my console and start it using the "npm run dev" command.
With the NodeJs dashboard running, we have this screen in front of us. On the upper left-hand corner we have our standard out pane, which is going to show all of your standard log messages logged out with console.log, or something similar. Below that is the standard error pane which is where we can send our console error messages.
This is cool, because it's going to allow us to use two different panes to see our log messages versus our error messages and identify those error messages more easily, even whenever there's a lot of output coming from the logs.
Over here we have the CPU utilization. In this utilization, the way it's calculating it is it's only the utilization used by this node process. Even if the CPU load or utilization is high due to other processes on this box, you're only going to see the utilization that NodeJs itself is using.
Next down we have the event loop delay. This is the delay in milliseconds that each cycle of the event loop is taking.
Finally, we have our memory chart which shows the heap usage. We have the amount of memory allocated, and then showing how much of that is used versus how much is free. Then we have our total resident memory size below, followed by the total amount of memory available on the system.
Off the screen I have another console window open. I'm just hitting the up arrow followed by the inner key that runs the curl command we were using earlier. You can see each time I execute it, it shows the random word generated by faker, as well as the HTTP response from the node application and the duration of that request.