Debugging NodeJS Services Using Breakpoints in VS Code

Brian Jenney
3 min readFeb 10, 2021

Stop using 108 console logs in your NodeJS app to debug your API endpoints. I used to employ this same method of saturating my code with logs until a wiser developer showed our team how to pause execution using VSCode.

The problem with relying on tons of logging is that it quickly becomes confusing, especially when dealing with asynchronous logic. Now your console log in that promise is being called out of order or perhaps you logged a deeply nested object and your console only prints [object] . Aarrggghhh. You hammer the endpoint with more and more requests, add more console logs. Great now you’ve hit a rate limit from a third party API you were experimenting with.

There’s a better way.

Open your NodeJS project and run the project from the integrated terminal (this is important or it will not work). Now click on that bug icon on the left side of the screen.

Open the dropdown that you see at the top of the page and select Add Configuration

--

--

Brian Jenney
Brian Jenney

Written by Brian Jenney

full-stackish developer, late bloomer coder and power google user and owner of Parsity.io

Responses (1)