Node.js Quick Tips Quick Tips

Display the internal Express logs to help you debug your application

< 1 min read

It can be really tricky to debug what’s happening with an Express application in development. After years of working with this framework I was amazed to discover that it internally logs "route matches, middleware functions that are in use, application mode, and the flow of the request-response cycle".

To see these super useful logs in your terminal you need to set a DEBUG environment variable e.g.

DEBUG=express:* node src/server.js
Screenshot of debug output from an Express application in a terminal

You can read more about this feature in the official Express guide to Debugging Express.

Original tweet