The getting started page for the Express application generator (located here) says to start the server by using $ DEBUG=myapp:* npm start
if using MacOS or Linux.
This works fine, but I'm having trouble understanding what this line is actually doing. I would have guessed that it would be assigning something to the variable DEBUG
, but after exiting the server I ran echo $DEBUG
and it printed nothing. I'm guessing the :
is somehow key here, but it's not clear to me how/why.
Hopefully someone can break this down for me.
DEBUG=myapp:* npm start
consist of two parts.
The first part is DEBUG=myapp:*
and the second part is npm start
You may run DEBUG=myapp:*
first in your command-line tool, and then
followed by running npm start
.
DEBUG=myapp:*
means you are telling nodejs that you want to turn on logging for debugging purposes.
myapp
with your app name. You can find your app name in package.json file under "name"
property.
*
in myapp:*
means to see all the internal logs used in Expressmyapp:router
. Likewise, to see logs only from the application implementation set the value of DEBUG to myapp:application
, and so on.npm start
is telling npm to run your scripts
stated in the package.json file and the script name is called start
Source: https://expressjs.com/en/guide/debugging.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With