Best practices for using a REPL debugger with Express.js / Node.js

197 Views Asked by At

I'm trying to understand how a framework built with Express.js, called Probot, works.

I'm fairly new to JS and Node.js, but I know my way around Ruby / Rails. When I'm trying to debug something with Ruby / Rails, I'll use [byebug][2]. I'll insert byebug into my Ruby code with a running local server (i.e. rails server), the server process stops, and I'm able to interactively decipher my code's context near that byebug statement.

Is there an existing library or function that enables this same functionality with Node.js / Express.js / Probot? My scaffolded app is invoked with npm start, so it's not necessarily a matter of debugging regular JavaScript code, but being able to understand how my local server is interacting with an external API.

1

There are 1 best solutions below

0
Benn On

You'll want to use the inspector in a chrome-based browser or your IDE, along with a debugger; statement to cause it to break at a specific location. It's not as elegant as some other languages, unfortunately, but it does tap pretty cleanly into various tools.